]> icculus.org git repositories - btb/d2x.git/blob - include/ignorecase.h
Enable global structs for mine saving functions
[btb/d2x.git] / include / ignorecase.h
1 /** \file ignorecase.h */
2
3 /**
4  * \mainpage PhysicsFS ignorecase
5  *
6  * This is an extension to PhysicsFS to let you handle files in a
7  *  case-insensitive manner, regardless of what sort of filesystem or
8  *  archive they reside in. It does this by enumerating directories as
9  *  needed and manually locating matching entries.
10  *
11  * Please note that this brings with it some caveats:
12  *  - On filesystems that are case-insensitive to start with, such as those
13  *    used on Windows or MacOS, you are adding extra overhead.
14  *  - On filesystems that are case-sensitive, you might select the wrong dir
15  *    or file (which brings security considerations and potential bugs). This
16  *    code favours exact case matches, but you will lose access to otherwise
17  *    duplicate filenames, or you might go down a wrong directory tree, etc.
18  *    In practive, this is rarely a problem, but you need to be aware of it.
19  *  - This doesn't do _anything_ with the write directory; you're on your
20  *    own for opening the right files for writing. You can sort of get around
21  *    this by adding your write directory to the search path, but then the
22  *    interpolated directory tree can screw you up even more.
23  *
24  * This code should be considered an aid for legacy code. New development
25  *  shouldn't do dumbass things that require this aid in the first place.  :)
26  *
27  * Usage: Set up PhysicsFS as you normally would, then use
28  *  PHYSFSEXT_locateCorrectCase() to get a "correct" pathname to pass to
29  *  functions like PHYSFS_openRead(), etc.
30  *
31  * License: this code is public domain. I make no warranty that it is useful,
32  *  correct, harmless, or environmentally safe.
33  *
34  * This particular file may be used however you like, including copying it
35  *  verbatim into a closed-source project, exploiting it commercially, and
36  *  removing any trace of my name from the source (although I hope you won't
37  *  do that). I welcome enhancements and corrections to this file, but I do
38  *  not require you to send me patches if you make changes. This code has
39  *  NO WARRANTY.
40  *
41  * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
42  *  Please see LICENSE in the root of the source tree.
43  *
44  *  \author Ryan C. Gordon.
45  */
46
47
48 /**
49  * \fn int PHYSFSEXT_locateCorrectCase(char *buf)
50  * \brief Find an existing filename with matching case.
51  *
52  * This function will look for a path/filename that matches the passed in
53  *  buffer. Each element of the buffer's path is checked for a
54  *  case-insensitive match. The buffer must specify a null-terminated string
55  *  in platform-independent notation.
56  *
57  * Please note results may be skewed differently depending on whether symlinks
58  *  are enabled or not.
59  *
60  * Each element of the buffer is overwritten with the actual case of an
61  *  existing match. If there is no match, the search aborts and reports an
62  *  error. Exact matches are favored over case-insensitive matches.
63  *
64  * THIS IS RISKY. Please do not use this function for anything but crappy
65  *  legacy code.
66  *
67  *   \param buf Buffer with null-terminated string of path/file to locate.
68  *               This buffer will be modified by this function.
69  *  \return zero if match was found, -1 if the final element (the file itself)
70  *               is missing, -2 if one of the parent directories is missing.
71  */
72 int PHYSFSEXT_locateCorrectCase(char *buf);
73
74 /* end of ignorecase.h ... */
75