author | David Yip <dwyip@peach-bun.com> |
Mon, 15 Aug 2016 00:50:58 -0500 | |
changeset 1375 | 20ee02ea086c |
parent 1182 | 9ba19d71cc4a |
permissions | -rw-r--r-- |
1182
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
1 |
#ifndef INCL_PHYSFSEXT_GLOBBING_H |
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
2 |
#define INCL_PHYSFSEXT_GLOBBING_H |
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
3 |
|
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
4 |
/** \file globbing.h */ |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
5 |
|
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
6 |
#include "physfs.h" |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
7 |
|
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
8 |
/** |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
9 |
* \mainpage PhysicsFS globbing |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
10 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
11 |
* This is an extension to PhysicsFS to let you search for files with basic |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
12 |
* wildcard matching, regardless of what sort of filesystem or archive they |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
13 |
* reside in. It does this by enumerating directories as needed and manually |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
14 |
* locating matching entries. |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
15 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
16 |
* Usage: Set up PhysicsFS as you normally would, then use |
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
17 |
* PHYSFSEXT_enumerateFilesWildcard() when enumerating files. This is just |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
18 |
* like PHYSFS_enumerateFiles(), but it returns a subset that matches your |
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
19 |
* wildcard pattern. You must call PHYSFSEXT_freeEnumeration() on the results, |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
20 |
* just PHYSFS_enumerateFiles() would do with PHYSFS_freeList(). |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
21 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
22 |
* License: this code is public domain. I make no warranty that it is useful, |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
23 |
* correct, harmless, or environmentally safe. |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
24 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
25 |
* This particular file may be used however you like, including copying it |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
26 |
* verbatim into a closed-source project, exploiting it commercially, and |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
27 |
* removing any trace of my name from the source (although I hope you won't |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
28 |
* do that). I welcome enhancements and corrections to this file, but I do |
576
5da65f8e9a50
Switched to zlib license.
Ryan C. Gordon <icculus@icculus.org>
parents:
573
diff
changeset
|
29 |
* not require you to send me patches if you make changes. This code has |
5da65f8e9a50
Switched to zlib license.
Ryan C. Gordon <icculus@icculus.org>
parents:
573
diff
changeset
|
30 |
* NO WARRANTY. |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
31 |
* |
576
5da65f8e9a50
Switched to zlib license.
Ryan C. Gordon <icculus@icculus.org>
parents:
573
diff
changeset
|
32 |
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. |
972
254427fc42ab
Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents:
809
diff
changeset
|
33 |
* Please see LICENSE.txt in the source's "docs" directory. |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
34 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
35 |
* \author Ryan C. Gordon. |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
36 |
*/ |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
37 |
|
1182
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
38 |
#ifdef __cplusplus |
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
39 |
extern "C" { |
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
40 |
#endif |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
41 |
|
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
42 |
/** |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
43 |
* \fn char **PHYSFS_enumerateFilesWildcard(const char *dir, const char *wildcard, int caseSensitive) |
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
44 |
* \brief Get a file listing of a search path's directory, filtered with a wildcard pattern. |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
45 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
46 |
* Matching directories are interpolated. That is, if "C:\mydir" is in the |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
47 |
* search path and contains a directory "savegames" that contains "x.sav", |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
48 |
* "y.Sav", and "z.txt", and there is also a "C:\userdir" in the search path |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
49 |
* that has a "savegames" subdirectory with "w.sav", then the following code: |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
50 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
51 |
* \code |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
52 |
* char **rc = PHYSFS_enumerateFilesWildcard("savegames", "*.sav", 0); |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
53 |
* char **i; |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
54 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
55 |
* for (i = rc; *i != NULL; i++) |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
56 |
* printf(" * We've got [%s].\n", *i); |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
57 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
58 |
* PHYSFS_freeList(rc); |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
59 |
* \endcode |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
60 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
61 |
* ...will print: |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
62 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
63 |
* \verbatim |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
64 |
* We've got [x.sav]. |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
65 |
* We've got [y.Sav]. |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
66 |
* We've got [w.sav].\endverbatim |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
67 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
68 |
* Feel free to sort the list however you like. We only promise there will |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
69 |
* be no duplicates, but not what order the final list will come back in. |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
70 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
71 |
* Wildcard strings can use the '*' and '?' characters, currently. |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
72 |
* Matches can be case-insensitive if you pass a zero for argument 3. |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
73 |
* |
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
74 |
* Don't forget to call PHYSFSEXT_freeEnumerator() with the return value from |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
75 |
* this function when you are done with it. As we use PhysicsFS's allocator |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
76 |
* for this list, you must free it before calling PHYSFS_deinit(). |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
77 |
* Do not use PHYSFS_freeList() on the returned value! |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
78 |
* |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
79 |
* \param dir directory in platform-independent notation to enumerate. |
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
80 |
* \param wildcard Wildcard pattern to use for filtering. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
81 |
* \param caseSensitive Zero for case-insensitive matching, |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
82 |
* non-zero for case-sensitive. |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
83 |
* \return Null-terminated array of null-terminated strings. |
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
84 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
85 |
* \sa PHYSFSEXT_freeEnumeration |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
86 |
*/ |
1024
199e38498938
Renamed __EXPORT__ to PHYSFS_DECL.
Ryan C. Gordon <icculus@icculus.org>
parents:
977
diff
changeset
|
87 |
PHYSFS_DECL char **PHYSFSEXT_enumerateFilesWildcard(const char *dir, |
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
88 |
const char *wildcard, |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
89 |
int caseSensitive); |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
90 |
|
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
91 |
/** |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
92 |
* \fn void PHYSFSEXT_freeEnumeration(char **list) |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
93 |
* \brief Free data returned by PHYSFSEXT_enumerateFilesWildcard |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
94 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
95 |
* Conceptually, this works like PHYSFS_freeList(), but is used with data |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
96 |
* returned by PHYSFSEXT_enumerateFilesWildcard() only. Be sure to call this |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
97 |
* on any returned data from that function before |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
98 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
99 |
* \param list Pointer previously returned by |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
100 |
* PHYSFSEXT_enumerateFilesWildcard(). It is safe to pass a |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
101 |
* NULL here. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
102 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
103 |
* \sa PHYSFSEXT_enumerateFilesWildcard |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
104 |
*/ |
1024
199e38498938
Renamed __EXPORT__ to PHYSFS_DECL.
Ryan C. Gordon <icculus@icculus.org>
parents:
977
diff
changeset
|
105 |
PHYSFS_DECL void PHYSFSEXT_freeEnumeration(char **list); |
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
106 |
|
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
107 |
|
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
108 |
/** |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
109 |
* \fn void PHYSFSEXT_enumerateFilesCallbackWildcard(const char *dir, const char *wildcard, int caseSensitive, PHYSFS_EnumFilesCallback c, void *d); |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
110 |
* \brief Get a file listing of a search path's directory, filtered with a wildcard pattern, using an application-defined callback. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
111 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
112 |
* This function is equivalent to PHYSFSEXT_enumerateFilesWildcard(). It |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
113 |
* reports file listings, filtered by a wildcard pattern. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
114 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
115 |
* Unlike PHYSFS_enumerateFiles(), this function does not return an array. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
116 |
* Rather, it calls a function specified by the application once per |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
117 |
* element of the search path: |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
118 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
119 |
* \code |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
120 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
121 |
* static void printDir(void *data, const char *origdir, const char *fname) |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
122 |
* { |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
123 |
* printf(" * We've got [%s] in [%s].\n", fname, origdir); |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
124 |
* } |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
125 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
126 |
* // ... |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
127 |
* PHYSFS_enumerateFilesCallbackWildcard("savegames","*.sav",0,printDir,NULL); |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
128 |
* \endcode |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
129 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
130 |
* Items sent to the callback are not guaranteed to be in any order whatsoever. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
131 |
* There is no sorting done at this level, and if you need that, you should |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
132 |
* probably use PHYSFS_enumerateFilesWildcard() instead, which guarantees |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
133 |
* alphabetical sorting. This form reports whatever is discovered in each |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
134 |
* archive before moving on to the next. Even within one archive, we can't |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
135 |
* guarantee what order it will discover data. <em>Any sorting you find in |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
136 |
* these callbacks is just pure luck. Do not rely on it.</em> As this walks |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
137 |
* the entire list of archives, you may receive duplicate filenames. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
138 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
139 |
* Wildcard strings can use the '*' and '?' characters, currently. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
140 |
* Matches can be case-insensitive if you pass a zero for argument 3. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
141 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
142 |
* \param dir Directory, in platform-independent notation, to enumerate. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
143 |
* \param wildcard Wildcard pattern to use for filtering. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
144 |
* \param caseSensitive Zero for case-insensitive matching, |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
145 |
* non-zero for case-sensitive. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
146 |
* \param c Callback function to notify about search path elements. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
147 |
* \param d Application-defined data passed to callback. Can be NULL. |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
148 |
* |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
149 |
* \sa PHYSFS_EnumFilesCallback |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
150 |
* \sa PHYSFS_enumerateFiles |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
151 |
*/ |
1024
199e38498938
Renamed __EXPORT__ to PHYSFS_DECL.
Ryan C. Gordon <icculus@icculus.org>
parents:
977
diff
changeset
|
152 |
PHYSFS_DECL void PHYSFSEXT_enumerateFilesCallbackWildcard(const char *dir, |
977
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
153 |
const char *wildcard, |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
154 |
int caseSensitive, |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
155 |
PHYSFS_EnumFilesCallback c, |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
156 |
void *d); |
5a2f49a5f804
Improved globbing extra.
Ryan C. Gordon <icculus@icculus.org>
parents:
972
diff
changeset
|
157 |
|
1182
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
158 |
#ifdef __cplusplus |
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
159 |
} |
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
160 |
#endif |
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
161 |
|
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
162 |
#endif /* include-once blocker. */ |
9ba19d71cc4a
Put some include-once and extern "C" blocks in the extras' headers.
Ryan C. Gordon <icculus@icculus.org>
parents:
1024
diff
changeset
|
163 |
|
573
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
164 |
/* end of globbing.h ... */ |
01112353ffad
First stab at globbing extension.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
165 |