author | Ryan C. Gordon <icculus@icculus.org> |
Sun, 01 Dec 2002 11:21:27 +0000 | |
changeset 508 | 0e75524a96af |
parent 397 | 12ff23d3d716 |
child 527 | fa0330949c77 |
permissions | -rw-r--r-- |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1 |
/** \file physfs.h */ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
2 |
|
1 | 3 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
4 |
* \mainpage PhysicsFS |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
5 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
6 |
* The latest version of PhysicsFS can be found at: |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
7 |
* http://icculus.org/physfs/ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
8 |
* |
1 | 9 |
* PhysicsFS; a portable, flexible file i/o abstraction. |
10 |
* |
|
11 |
* This API gives you access to a system file system in ways superior to the |
|
12 |
* stdio or system i/o calls. The brief benefits: |
|
13 |
* |
|
14 |
* - It's portable. |
|
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
15 |
* - It's safe. No file access is permitted outside the specified dirs. |
1 | 16 |
* - It's flexible. Archives (.ZIP files) can be used transparently as |
17 |
* directory structures. |
|
18 |
* |
|
19 |
* This system is largely inspired by Quake 3's PK3 files and the related |
|
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
20 |
* fs_* cvars. If you've ever tinkered with these, then this API will be |
1 | 21 |
* familiar to you. |
22 |
* |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
23 |
* With PhysicsFS, you have a single writing directory and multiple |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
24 |
* directories (the "search path") for reading. You can think of this as a |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
25 |
* filesystem within a filesystem. If (on Windows) you were to set the |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
26 |
* writing directory to "C:\MyGame\MyWritingDirectory", then no PHYSFS calls |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
27 |
* could touch anything above this directory, including the "C:\MyGame" and |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
28 |
* "C:\" directories. This prevents an application's internal scripting |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
29 |
* language from piddling over c:\config.sys, for example. If you'd rather |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
30 |
* give PHYSFS full access to the system's REAL file system, set the writing |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
31 |
* dir to "C:\", but that's generally A Bad Thing for several reasons. |
1 | 32 |
* |
33 |
* Drive letters are hidden in PhysicsFS once you set up your initial paths. |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
34 |
* The search path creates a single, hierarchical directory structure. |
1 | 35 |
* Not only does this lend itself well to general abstraction with archives, |
36 |
* it also gives better support to operating systems like MacOS and Unix. |
|
37 |
* Generally speaking, you shouldn't ever hardcode a drive letter; not only |
|
38 |
* does this hurt portability to non-Microsoft OSes, but it limits your win32 |
|
39 |
* users to a single drive, too. Use the PhysicsFS abstraction functions and |
|
40 |
* allow user-defined configuration options, too. When opening a file, you |
|
41 |
* specify it like it was on a Unix filesystem: if you want to write to |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
42 |
* "C:\MyGame\MyConfigFiles\game.cfg", then you might set the write dir to |
1 | 43 |
* "C:\MyGame" and then open "MyConfigFiles/game.cfg". This gives an |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
44 |
* abstraction across all platforms. Specifying a file in this way is termed |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
45 |
* "platform-independent notation" in this documentation. Specifying a |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
46 |
* a filename in a form such as "C:\mydir\myfile" or |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
47 |
* "MacOS hard drive:My Directory:My File" is termed "platform-dependent |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
48 |
* notation". The only time you use platform-dependent notation is when |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
49 |
* setting up your write directory and search path; after that, all file |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
50 |
* access into those directories are done with platform-independent notation. |
1 | 51 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
52 |
* All files opened for writing are opened in relation to the write directory, |
1 | 53 |
* which is the root of the writable filesystem. When opening a file for |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
54 |
* reading, PhysicsFS goes through the search path. This is NOT the |
1 | 55 |
* same thing as the PATH environment variable. An application using |
56 |
* PhysicsFS specifies directories to be searched which may be actual |
|
57 |
* directories, or archive files that contain files and subdirectories of |
|
58 |
* their own. See the end of these docs for currently supported archive |
|
59 |
* formats. |
|
60 |
* |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
61 |
* Once the search path is defined, you may open files for reading. If you've |
1 | 62 |
* got the following search path defined (to use a win32 example again): |
63 |
* |
|
64 |
* C:\mygame |
|
65 |
* C:\mygame\myuserfiles |
|
66 |
* D:\mygamescdromdatafiles |
|
67 |
* C:\mygame\installeddatafiles.zip |
|
68 |
* |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
69 |
* Then a call to PHYSFS_openRead("textfiles/myfile.txt") (note the directory |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
70 |
* separator, lack of drive letter, and lack of dir separator at the start of |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
71 |
* the string; this is platform-independent notation) will check for |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
72 |
* C:\mygame\textfiles\myfile.txt, then |
1 | 73 |
* C:\mygame\myuserfiles\textfiles\myfile.txt, then |
74 |
* D:\mygamescdromdatafiles\textfiles\myfile.txt, then, finally, for |
|
75 |
* textfiles\myfile.txt inside of C:\mygame\installeddatafiles.zip. Remember |
|
76 |
* that most archive types and platform filesystems store their filenames in |
|
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
77 |
* a case-sensitive manner, so you should be careful to specify it correctly. |
1 | 78 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
79 |
* Files opened through PhysicsFS may NOT contain "." or ".." or ":" as dir |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
80 |
* elements. Not only are these meaningless on MacOS and/or Unix, they are a |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
81 |
* security hole. Also, symbolic links (which can be found in some archive |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
82 |
* types and directly in the filesystem on Unix platforms) are NOT followed |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
83 |
* until you call PHYSFS_permitSymbolicLinks(). That's left to your own |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
84 |
* discretion, as following a symlink can allow for access outside the write |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
85 |
* dir and search paths. There is no mechanism for creating new symlinks in |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
86 |
* PhysicsFS. |
1 | 87 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
88 |
* The write dir is not included in the search path unless you specifically |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
89 |
* add it. While you CAN change the write dir as many times as you like, |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
90 |
* you should probably set it once and stick to it. Remember that your |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
91 |
* program will not have permission to write in every directory on Unix and |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
92 |
* NT systems. |
1 | 93 |
* |
94 |
* All files are opened in binary mode; there is no endline conversion for |
|
95 |
* textfiles. Other than that, PhysicsFS has some convenience functions for |
|
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
96 |
* platform-independence. There is a function to tell you the current |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
97 |
* platform's dir separator ("\\" on windows, "/" on Unix, ":" on MacOS), |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
98 |
* which is needed only to set up your search/write paths. There is a |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
99 |
* function to tell you what CD-ROM drives contain accessible discs, and a |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
100 |
* function to recommend a good search path, etc. |
1 | 101 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
102 |
* A recommended order for the search path is the write dir, then the base dir, |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
103 |
* then the cdrom dir, then any archives discovered. Quake 3 does something |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
104 |
* like this, but moves the archives to the start of the search path. Build |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
105 |
* Engine games, like Duke Nukem 3D and Blood, place the archives last, and |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
106 |
* use the base dir for both searching and writing. There is a helper |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
107 |
* function (PHYSFS_setSaneConfig()) that puts together a basic configuration |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
108 |
* for you, based on a few parameters. Also see the comments on |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
109 |
* PHYSFS_getBaseDir(), and PHYSFS_getUserDir() for info on what those |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
110 |
* are and how they can help you determine an optimal search path. |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
111 |
* |
147
5e1eda65ceb3
Updated comment on thread safety.
Ryan C. Gordon <icculus@icculus.org>
parents:
137
diff
changeset
|
112 |
* PhysicsFS is mostly thread safe. The error messages returned by |
5e1eda65ceb3
Updated comment on thread safety.
Ryan C. Gordon <icculus@icculus.org>
parents:
137
diff
changeset
|
113 |
* PHYSFS_getLastError are unique by thread, and library-state-setting |
5e1eda65ceb3
Updated comment on thread safety.
Ryan C. Gordon <icculus@icculus.org>
parents:
137
diff
changeset
|
114 |
* functions are mutex'd. For efficiency, individual file accesses are |
5e1eda65ceb3
Updated comment on thread safety.
Ryan C. Gordon <icculus@icculus.org>
parents:
137
diff
changeset
|
115 |
* not locked, so you can not safely read/write/seek/close/etc the same |
5e1eda65ceb3
Updated comment on thread safety.
Ryan C. Gordon <icculus@icculus.org>
parents:
137
diff
changeset
|
116 |
* file from two threads at the same time. Other race conditions are bugs |
5e1eda65ceb3
Updated comment on thread safety.
Ryan C. Gordon <icculus@icculus.org>
parents:
137
diff
changeset
|
117 |
* that should be reported/patched. |
1 | 118 |
* |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
119 |
* While you CAN use stdio/syscall file access in a program that has PHYSFS_* |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
120 |
* calls, doing so is not recommended, and you can not use system |
147
5e1eda65ceb3
Updated comment on thread safety.
Ryan C. Gordon <icculus@icculus.org>
parents:
137
diff
changeset
|
121 |
* filehandles with PhysicsFS and vice versa. |
1 | 122 |
* |
123 |
* Note that archives need not be named as such: if you have a ZIP file and |
|
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
124 |
* rename it with a .PKG extension, the file will still be recognized as a |
1 | 125 |
* ZIP archive by PhysicsFS; the file's contents are used to determine its |
126 |
* type. |
|
127 |
* |
|
128 |
* Currently supported archive types: |
|
129 |
* - .ZIP (pkZip/WinZip/Info-ZIP compatible) |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
130 |
* - .GRP (Build Engine groupfile archives) |
1 | 131 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
132 |
* Please see the file LICENSE in the source's root directory for licensing |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
133 |
* and redistribution rights. |
1 | 134 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
135 |
* Please see the file CREDITS in the source's root directory for a complete |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
136 |
* list of who's responsible for this. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
137 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
138 |
* \author Ryan C. Gordon. |
1 | 139 |
*/ |
140 |
||
141 |
#ifndef _INCLUDE_PHYSFS_H_ |
|
142 |
#define _INCLUDE_PHYSFS_H_ |
|
143 |
||
144 |
#ifdef __cplusplus |
|
145 |
extern "C" { |
|
146 |
#endif |
|
147 |
||
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
148 |
#ifndef DOXYGEN_SHOULD_IGNORE_THIS |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
149 |
#if (defined _MSC_VER) |
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
150 |
#define __EXPORT__ __declspec(dllexport) |
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
151 |
#else |
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
152 |
#define __EXPORT__ |
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
153 |
#endif |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
154 |
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
155 |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
156 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
157 |
* \typedef PHYSFS_uint8 |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
158 |
* \brief An unsigned, 8-bit integer type. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
159 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
160 |
typedef unsigned char PHYSFS_uint8; |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
161 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
162 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
163 |
* \typedef PHYSFS_sint8 |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
164 |
* \brief A signed, 8-bit integer type. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
165 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
166 |
typedef signed char PHYSFS_sint8; |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
167 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
168 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
169 |
* \typedef PHYSFS_uint16 |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
170 |
* \brief An unsigned, 16-bit integer type. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
171 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
172 |
typedef unsigned short PHYSFS_uint16; |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
173 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
174 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
175 |
* \typedef PHYSFS_sint16 |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
176 |
* \brief A signed, 16-bit integer type. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
177 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
178 |
typedef signed short PHYSFS_sint16; |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
179 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
180 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
181 |
* \typedef PHYSFS_uint32 |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
182 |
* \brief An unsigned, 32-bit integer type. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
183 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
184 |
typedef unsigned int PHYSFS_uint32; |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
185 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
186 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
187 |
* \typedef PHYSFS_sint32 |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
188 |
* \brief A signed, 32-bit integer type. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
189 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
190 |
typedef signed int PHYSFS_sint32; |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
191 |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
192 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
193 |
* \typedef PHYSFS_uint64 |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
194 |
* \brief An unsigned, 64-bit integer type. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
195 |
* \warning on platforms without any sort of 64-bit datatype, this is |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
196 |
* equivalent to PHYSFS_uint32! |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
197 |
*/ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
198 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
199 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
200 |
* \typedef PHYSFS_sint64 |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
201 |
* \brief A signed, 64-bit integer type. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
202 |
* \warning on platforms without any sort of 64-bit datatype, this is |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
203 |
* equivalent to PHYSFS_sint32! |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
204 |
*/ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
205 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
206 |
|
194
09c353d30cd4
Patches for correctness and cleaner win32 support.
Ryan C. Gordon <icculus@icculus.org>
parents:
178
diff
changeset
|
207 |
#if (defined PHYSFS_NO_64BIT_SUPPORT) /* oh well. */ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
208 |
typedef PHYSFS_uint32 PHYSFS_uint64; |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
209 |
typedef PHYSFS_sint32 PHYSFS_sint64; |
194
09c353d30cd4
Patches for correctness and cleaner win32 support.
Ryan C. Gordon <icculus@icculus.org>
parents:
178
diff
changeset
|
210 |
#elif (defined _MSC_VER) |
09c353d30cd4
Patches for correctness and cleaner win32 support.
Ryan C. Gordon <icculus@icculus.org>
parents:
178
diff
changeset
|
211 |
typedef signed __int64 PHYSFS_sint64; |
09c353d30cd4
Patches for correctness and cleaner win32 support.
Ryan C. Gordon <icculus@icculus.org>
parents:
178
diff
changeset
|
212 |
typedef unsigned __int64 PHYSFS_uint64; |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
213 |
#else |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
214 |
typedef unsigned long long PHYSFS_uint64; |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
215 |
typedef signed long long PHYSFS_sint64; |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
216 |
#endif |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
217 |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
218 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
219 |
#ifndef DOXYGEN_SHOULD_IGNORE_THIS |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
220 |
/* Make sure the types really have the right sizes */ |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
221 |
#define PHYSFS_COMPILE_TIME_ASSERT(name, x) \ |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
222 |
typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1] |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
223 |
|
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
224 |
PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1); |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
225 |
PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1); |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
226 |
PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2); |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
227 |
PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2); |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
228 |
PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4); |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
229 |
PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4); |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
230 |
|
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
231 |
#ifndef PHYSFS_NO_64BIT_SUPPORT |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
232 |
PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8); |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
233 |
PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8); |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
234 |
#endif |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
235 |
|
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
236 |
#undef PHYSFS_COMPILE_TIME_ASSERT |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
237 |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
238 |
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
239 |
|
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
240 |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
241 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
242 |
* \struct PHYSFS_file |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
243 |
* \brief A PhysicsFS file handle. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
244 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
245 |
* You get a pointer to one of these when you open a file for reading, |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
246 |
* writing, or appending via PhysicsFS. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
247 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
248 |
* As you can see from the lack of meaningful fields, you should treat this |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
249 |
* as opaque data. Don't try to manipulate the file handle, just pass the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
250 |
* pointer you got, unmolested, to various PhysicsFS APIs. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
251 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
252 |
* \sa PHYSFS_openRead |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
253 |
* \sa PHYSFS_openWrite |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
254 |
* \sa PHYSFS_openAppend |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
255 |
* \sa PHYSFS_close |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
256 |
* \sa PHYSFS_read |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
257 |
* \sa PHYSFS_write |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
258 |
* \sa PHYSFS_seek |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
259 |
* \sa PHYSFS_tell |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
260 |
* \sa PHYSFS_eof |
508 | 261 |
* \sa PHYSFS_setBuffer |
262 |
* \sa PHYSFS_flush |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
263 |
*/ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
264 |
typedef struct |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
265 |
{ |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
266 |
void *opaque; /**< That's all you get. Don't touch. */ |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
267 |
} PHYSFS_file; |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
268 |
|
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
269 |
|
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
270 |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
271 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
272 |
* \struct PHYSFS_ArchiveInfo |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
273 |
* \brief Information on various PhysicsFS-supported archives. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
274 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
275 |
* This structure gives you details on what sort of archives are supported |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
276 |
* by this implementation of PhysicsFS. Archives tend to be things like |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
277 |
* ZIP files and such. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
278 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
279 |
* \warning Not all binaries are created equal! PhysicsFS can be built with |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
280 |
* or without support for various archives. You can check with |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
281 |
* PHYSFS_supportedArchiveTypes() to see if your archive type is |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
282 |
* supported. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
283 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
284 |
* \sa PHYSFS_supportedArchiveTypes |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
285 |
*/ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
286 |
typedef struct |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
287 |
{ |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
288 |
const char *extension; /**< Archive file extension: "ZIP", for example. */ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
289 |
const char *description; /**< Human-readable archive description. */ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
290 |
const char *author; /**< Person who did support for this archive. */ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
291 |
const char *url; /**< URL related to this archive */ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
292 |
} PHYSFS_ArchiveInfo; |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
293 |
|
508 | 294 |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
295 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
296 |
* \struct PHYSFS_Version |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
297 |
* \brief Information the version of PhysicsFS in use. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
298 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
299 |
* Represents the library's version as three levels: major revision |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
300 |
* (increments with massive changes, additions, and enhancements), |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
301 |
* minor revision (increments with backwards-compatible changes to the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
302 |
* major revision), and patchlevel (increments with fixes to the minor |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
303 |
* revision). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
304 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
305 |
* \sa PHYSFS_VERSION |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
306 |
* \sa PHYFS_getLinkedVersion |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
307 |
*/ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
308 |
typedef struct |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
309 |
{ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
310 |
PHYSFS_uint8 major; /**< major revision */ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
311 |
PHYSFS_uint8 minor; /**< minor revision */ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
312 |
PHYSFS_uint8 patch; /**< patchlevel */ |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
313 |
} PHYSFS_Version; |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
314 |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
315 |
#ifndef DOXYGEN_SHOULD_IGNORE_THIS |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
316 |
#define PHYSFS_VER_MAJOR 0 |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
317 |
#define PHYSFS_VER_MINOR 1 |
322
597af607e7d3
Added PHYSFS_(read|write)[SU][BL]E(16|32|64) and upped version to 0.1.7.
Ryan C. Gordon <icculus@icculus.org>
parents:
265
diff
changeset
|
318 |
#define PHYSFS_VER_PATCH 7 |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
319 |
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
320 |
|
508 | 321 |
|
322 |
/* PhysicsFS state stuff ... */ |
|
323 |
||
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
324 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
325 |
* \def PHYSFS_VERSION(x) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
326 |
* \brief Macro to determine PhysicsFS version program was compiled against. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
327 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
328 |
* This macro fills in a PHYSFS_Version structure with the version of the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
329 |
* library you compiled against. This is determined by what header the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
330 |
* compiler uses. Note that if you dynamically linked the library, you might |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
331 |
* have a slightly newer or older version at runtime. That version can be |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
332 |
* determined with PHYSFS_getLinkedVersion(), which, unlike PHYSFS_VERSION, |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
333 |
* is not a macro. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
334 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
335 |
* \param x A pointer to a PHYSFS_Version struct to initialize. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
336 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
337 |
* \sa PHYSFS_Version |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
338 |
* \sa PHYSFS_getLinkedVersion |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
339 |
*/ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
340 |
#define PHYSFS_VERSION(x) \ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
341 |
{ \ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
342 |
(x)->major = PHYSFS_VER_MAJOR; \ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
343 |
(x)->minor = PHYSFS_VER_MINOR; \ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
344 |
(x)->patch = PHYSFS_VER_PATCH; \ |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
345 |
} |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
346 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
347 |
|
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
348 |
/** |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
349 |
* \fn void PHYSFS_getLinkedVersion(PHYSFS_Version *ver) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
350 |
* \brief Get the version of PhysicsFS that is linked against your program. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
351 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
352 |
* If you are using a shared library (DLL) version of PhysFS, then it is |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
353 |
* possible that it will be different than the version you compiled against. |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
354 |
* |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
355 |
* This is a real function; the macro PHYSFS_VERSION tells you what version |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
356 |
* of PhysFS you compiled against: |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
357 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
358 |
* \code |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
359 |
* PHYSFS_Version compiled; |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
360 |
* PHYSFS_Version linked; |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
361 |
* |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
362 |
* PHYSFS_VERSION(&compiled); |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
363 |
* PHYSFS_getLinkedVersion(&linked); |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
364 |
* printf("We compiled against PhysFS version %d.%d.%d ...\n", |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
365 |
* compiled.major, compiled.minor, compiled.patch); |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
366 |
* printf("But we linked against PhysFS version %d.%d.%d.\n", |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
367 |
* linked.major, linked.minor, linked.patch); |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
368 |
* \endcode |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
369 |
* |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
370 |
* This function may be called safely at any time, even before PHYSFS_init(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
371 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
372 |
* \sa PHYSFS_VERSION |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
373 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
374 |
__EXPORT__ void PHYSFS_getLinkedVersion(PHYSFS_Version *ver); |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
375 |
|
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
376 |
|
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
377 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
378 |
* \fn int PHYSFS_init(const char *argv0) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
379 |
* \brief Initialize the PhysicsFS library. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
380 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
381 |
* This must be called before any other PhysicsFS function. |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
382 |
* |
23
bd6ba9c8717c
Initial debugging: dropped PhysicsFS routines into the Build engine,
Ryan C. Gordon <icculus@icculus.org>
parents:
15
diff
changeset
|
383 |
* This should be called prior to any attempts to change your process's |
bd6ba9c8717c
Initial debugging: dropped PhysicsFS routines into the Build engine,
Ryan C. Gordon <icculus@icculus.org>
parents:
15
diff
changeset
|
384 |
* current working directory. |
bd6ba9c8717c
Initial debugging: dropped PhysicsFS routines into the Build engine,
Ryan C. Gordon <icculus@icculus.org>
parents:
15
diff
changeset
|
385 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
386 |
* \param argv0 the argv[0] string passed to your program's mainline. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
387 |
* This may be NULL on most platforms (such as ones without a |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
388 |
* standard main() function), but you should always try to pass |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
389 |
* something in here. Unix-like systems such as Linux _need_ to |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
390 |
* pass argv[0] from main() in here. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
391 |
* \return nonzero on success, zero on error. Specifics of the error can be |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
392 |
* gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
393 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
394 |
* \sa PHYSFS_deinit |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
395 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
396 |
__EXPORT__ int PHYSFS_init(const char *argv0); |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
397 |
|
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
398 |
|
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
399 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
400 |
* \fn int PHYSFS_deinit(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
401 |
* \brief Deinitialize the PhysicsFS library. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
402 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
403 |
* This closes any files opened via PhysicsFS, blanks the search/write paths, |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
404 |
* frees memory, and invalidates all of your file handles. |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
405 |
* |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
406 |
* Note that this call can FAIL if there's a file open for writing that |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
407 |
* refuses to close (for example, the underlying operating system was |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
408 |
* buffering writes to network filesystem, and the fileserver has crashed, |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
409 |
* or a hard drive has failed, etc). It is usually best to close all write |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
410 |
* handles yourself before calling this function, so that you can gracefully |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
411 |
* handle a specific failure. |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
412 |
* |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
413 |
* Once successfully deinitialized, PHYSFS_init() can be called again to |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
414 |
* restart the subsystem. All defaults API states are restored at this |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
415 |
* point. |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
416 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
417 |
* \return nonzero on success, zero on error. Specifics of the error can be |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
418 |
* gleaned from PHYSFS_getLastError(). If failure, state of PhysFS is |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
419 |
* undefined, and probably badly screwed up. |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
420 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
421 |
* \sa PHYSFS_init |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
422 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
423 |
__EXPORT__ int PHYSFS_deinit(void); |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
424 |
|
1 | 425 |
|
426 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
427 |
* \fn const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
428 |
* \brief Get a list of supported archive types. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
429 |
* |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
430 |
* Get a list of archive types supported by this implementation of PhysicFS. |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
431 |
* These are the file formats usable for search path entries. This is for |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
432 |
* informational purposes only. Note that the extension listed is merely |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
433 |
* convention: if we list "ZIP", you can open a PkZip-compatible archive |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
434 |
* with an extension of "XYZ", if you like. |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
435 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
436 |
* The returned value is an array of pointers to PHYSFS_ArchiveInfo structures, |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
437 |
* with a NULL entry to signify the end of the list: |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
438 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
439 |
* \code |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
440 |
* PHYSFS_ArchiveInfo **i; |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
441 |
* |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
442 |
* for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++) |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
443 |
* { |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
444 |
* printf("Supported archive: [%s], which is [%s].\n", |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
445 |
* i->extension, i->description); |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
446 |
* } |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
447 |
* \endcode |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
448 |
* |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
449 |
* The return values are pointers to static internal memory, and should |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
450 |
* be considered READ ONLY, and never freed. |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
451 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
452 |
* \return READ ONLY Null-terminated array of READ ONLY structures. |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
453 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
454 |
__EXPORT__ const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void); |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
455 |
|
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
456 |
|
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
457 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
458 |
* \fn void PHYSFS_freeList(void *listVar) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
459 |
* \brief Deallocate resources of lists returned by PhysicsFS. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
460 |
* |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
461 |
* Certain PhysicsFS functions return lists of information that are |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
462 |
* dynamically allocated. Use this function to free those resources. |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
463 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
464 |
* \param listVar List of information specified as freeable by this function. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
465 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
466 |
* \sa PHYSFS_getCdRomDirs |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
467 |
* \sa PHYSFS_enumerateFiles |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
468 |
* \sa PHYSFS_getSearchPath |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
469 |
*/ |
128
31f754165105
Patched to fix a namespace issue.
Ryan C. Gordon <icculus@icculus.org>
parents:
126
diff
changeset
|
470 |
__EXPORT__ void PHYSFS_freeList(void *listVar); |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
471 |
|
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
472 |
|
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
473 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
474 |
* \fn const char *PHYSFS_getLastError(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
475 |
* \brief Get human-readable error information. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
476 |
* |
1 | 477 |
* Get the last PhysicsFS error message as a null-terminated string. |
478 |
* This will be NULL if there's been no error since the last call to this |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
479 |
* function. The pointer returned by this call points to an internal buffer. |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
480 |
* Each thread has a unique error state associated with it, but each time |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
481 |
* a new error message is set, it will overwrite the previous one associated |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
482 |
* with that thread. It is safe to call this function at anytime, even |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
483 |
* before PHYSFS_init(). |
1 | 484 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
485 |
* \return READ ONLY string of last error message. |
1 | 486 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
487 |
__EXPORT__ const char *PHYSFS_getLastError(void); |
1 | 488 |
|
489 |
||
490 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
491 |
* \fn const char *PHYSFS_getDirSeparator(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
492 |
* \brief Get platform-dependent dir separator string. |
1 | 493 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
494 |
* This returns "\\\\" on win32, "/" on Unix, and ":" on MacOS. It may be more |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
495 |
* than one character, depending on the platform, and your code should take |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
496 |
* that into account. Note that this is only useful for setting up the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
497 |
* search/write paths, since access into those dirs always use '/' |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
498 |
* (platform-independent notation) to separate directories. This is also |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
499 |
* handy for getting platform-independent access when using stdio calls. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
500 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
501 |
* \return READ ONLY null-terminated string of platform's dir separator. |
1 | 502 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
503 |
__EXPORT__ const char *PHYSFS_getDirSeparator(void); |
1 | 504 |
|
505 |
||
506 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
507 |
* \fn void PHYSFS_permitSymbolicLinks(int allow) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
508 |
* \brief Enable or disable following of symbolic links. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
509 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
510 |
* Some physical filesystems and archives contain files that are just pointers |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
511 |
* to other files. On the physical filesystem, opening such a link will |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
512 |
* (transparently) open the file that is pointed to. |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
513 |
* |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
514 |
* By default, PhysicsFS will check if a file is really a symlink during open |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
515 |
* calls and fail if it is. Otherwise, the link could take you outside the |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
516 |
* write and search paths, and compromise security. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
517 |
* |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
518 |
* If you want to take that risk, call this function with a non-zero parameter. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
519 |
* Note that this is more for sandboxing a program's scripting language, in |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
520 |
* case untrusted scripts try to compromise the system. Generally speaking, |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
521 |
* a user could very well have a legitimate reason to set up a symlink, so |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
522 |
* unless you feel there's a specific danger in allowing them, you should |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
523 |
* permit them. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
524 |
* |
39
bc29e1ee7ef6
Lots of bugfixes, enhancements, and corrections due to the work on
Ryan C. Gordon <icculus@icculus.org>
parents:
33
diff
changeset
|
525 |
* Symlinks are only explicitly checked when dealing with filenames |
bc29e1ee7ef6
Lots of bugfixes, enhancements, and corrections due to the work on
Ryan C. Gordon <icculus@icculus.org>
parents:
33
diff
changeset
|
526 |
* in platform-independent notation. That is, when setting up your |
bc29e1ee7ef6
Lots of bugfixes, enhancements, and corrections due to the work on
Ryan C. Gordon <icculus@icculus.org>
parents:
33
diff
changeset
|
527 |
* search and write paths, etc, symlinks are never checked for. |
bc29e1ee7ef6
Lots of bugfixes, enhancements, and corrections due to the work on
Ryan C. Gordon <icculus@icculus.org>
parents:
33
diff
changeset
|
528 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
529 |
* Symbolic link permission can be enabled or disabled at any time after |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
530 |
* you've called PHYSFS_init(), and is disabled by default. |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
531 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
532 |
* \param allow nonzero to permit symlinks, zero to deny linking. |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
533 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
534 |
__EXPORT__ void PHYSFS_permitSymbolicLinks(int allow); |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
535 |
|
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
536 |
|
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
537 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
538 |
* \fn char **PHYSFS_getCdRomDirs(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
539 |
* \brief Get an array of paths to available CD-ROM drives. |
1 | 540 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
541 |
* The dirs returned are platform-dependent ("D:\" on Win32, "/cdrom" or |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
542 |
* whatnot on Unix). Dirs are only returned if there is a disc ready and |
1 | 543 |
* accessible in the drive. So if you've got two drives (D: and E:), and only |
544 |
* E: has a disc in it, then that's all you get. If the user inserts a disc |
|
545 |
* in D: and you call this function again, you get both drives. If, on a |
|
546 |
* Unix box, the user unmounts a disc and remounts it elsewhere, the next |
|
547 |
* call to this function will reflect that change. Fun. |
|
548 |
* |
|
549 |
* The returned value is an array of strings, with a NULL entry to signify the |
|
550 |
* end of the list: |
|
551 |
* |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
552 |
* \code |
8
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
553 |
* char **cds = PHYSFS_getCdRomDirs(); |
1 | 554 |
* char **i; |
555 |
* |
|
8
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
556 |
* for (i = cds; *i != NULL; i++) |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
557 |
* printf("cdrom dir [%s] is available.\n", *i); |
1 | 558 |
* |
8
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
559 |
* PHYSFS_freeList(cds); |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
560 |
* \endcode |
8
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
561 |
* |
1 | 562 |
* This call may block while drives spin up. Be forewarned. |
563 |
* |
|
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
564 |
* When you are done with the returned information, you may dispose of the |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
565 |
* resources by calling PHYSFS_freeList() with the returned pointer. |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
566 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
567 |
* \return Null-terminated array of null-terminated strings. |
1 | 568 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
569 |
__EXPORT__ char **PHYSFS_getCdRomDirs(void); |
1 | 570 |
|
571 |
||
572 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
573 |
* \fn const char *PHYSFS_getBaseDir(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
574 |
* \brief Get the path where the application resides. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
575 |
* |
1 | 576 |
* Helper function. |
577 |
* |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
578 |
* Get the "base dir". This is the directory where the application was run |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
579 |
* from, which is probably the installation directory, and may or may not |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
580 |
* be the process's current working directory. |
1 | 581 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
582 |
* You should probably use the base dir in your search path. |
1 | 583 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
584 |
* \return READ ONLY string of base dir in platform-dependent notation. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
585 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
586 |
* \sa PHYSFS_getUserDir |
1 | 587 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
588 |
__EXPORT__ const char *PHYSFS_getBaseDir(void); |
1 | 589 |
|
590 |
||
591 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
592 |
* \fn const char *PHYSFS_getUserDir(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
593 |
* \brief Get the path where user's home directory resides. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
594 |
* |
1 | 595 |
* Helper function. |
596 |
* |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
597 |
* Get the "user dir". This is meant to be a suggestion of where a specific |
1 | 598 |
* user of the system can store files. On Unix, this is her home directory. |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
599 |
* On systems with no concept of multiple home directories (MacOS, win95), |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
600 |
* this will default to something like "C:\mybasedir\users\username" |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
601 |
* where "username" will either be the login name, or "default" if the |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
602 |
* platform doesn't support multiple users, either. |
1 | 603 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
604 |
* You should probably use the user dir as the basis for your write dir, and |
1 | 605 |
* also put it near the beginning of your search path. |
606 |
* |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
607 |
* \return READ ONLY string of user dir in platform-dependent notation. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
608 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
609 |
* \sa PHYSFS_getBaseDir |
1 | 610 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
611 |
__EXPORT__ const char *PHYSFS_getUserDir(void); |
1 | 612 |
|
613 |
||
614 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
615 |
* \fn const char *PHYSFS_getWriteDir(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
616 |
* \brief Get path where PhysicsFS will allow file writing. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
617 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
618 |
* Get the current write dir. The default write dir is NULL. |
1 | 619 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
620 |
* \return READ ONLY string of write dir in platform-dependent notation, |
1 | 621 |
* OR NULL IF NO WRITE PATH IS CURRENTLY SET. |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
622 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
623 |
* \sa PHYSFS_setWriteDir |
1 | 624 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
625 |
__EXPORT__ const char *PHYSFS_getWriteDir(void); |
1 | 626 |
|
627 |
||
628 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
629 |
* \fn int PHYSFS_setWriteDir(const char *newDir) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
630 |
* \brief Tell PhysicsFS where it may write files. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
631 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
632 |
* Set a new write dir. This will override the previous setting. If the |
1 | 633 |
* directory or a parent directory doesn't exist in the physical filesystem, |
634 |
* PhysicsFS will attempt to create them as needed. |
|
635 |
* |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
636 |
* This call will fail (and fail to change the write dir) if the current |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
637 |
* write dir still has files open in it. |
1 | 638 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
639 |
* \param newDir The new directory to be the root of the write dir, |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
640 |
* specified in platform-dependent notation. Setting to NULL |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
641 |
* disables the write dir, so no files can be opened for |
1 | 642 |
* writing via PhysicsFS. |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
643 |
* \return non-zero on success, zero on failure. All attempts to open a file |
1 | 644 |
* for writing via PhysicsFS will fail until this call succeeds. |
645 |
* Specifics of the error can be gleaned from PHYSFS_getLastError(). |
|
646 |
* |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
647 |
* \sa PHYSFS_getWriteDir |
1 | 648 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
649 |
__EXPORT__ int PHYSFS_setWriteDir(const char *newDir); |
1 | 650 |
|
651 |
||
652 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
653 |
* \fn int PHYSFS_addToSearchPath(const char *newDir, int appendToPath) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
654 |
* \brief Add an archive or directory to the search path. |
1 | 655 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
656 |
* If this is a duplicate, the entry is not added again, even though the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
657 |
* function succeeds. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
658 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
659 |
* \param newDir directory or archive to add to the path, in |
1 | 660 |
* platform-dependent notation. |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
661 |
* \param appendToPath nonzero to append to search path, zero to prepend. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
662 |
* \return nonzero if added to path, zero on failure (bogus archive, dir |
1 | 663 |
* missing, etc). Specifics of the error can be |
664 |
* gleaned from PHYSFS_getLastError(). |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
665 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
666 |
* \sa PHYSFS_removeFromSearchPath |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
667 |
* \sa PHYSFS_getSearchPath |
1 | 668 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
669 |
__EXPORT__ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath); |
1 | 670 |
|
671 |
||
672 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
673 |
* \fn int PHYSFS_removeFromSearchPath(const char *oldDir) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
674 |
* \brief Remove a directory or archive from the search path. |
1 | 675 |
* |
676 |
* This must be a (case-sensitive) match to a dir or archive already in the |
|
677 |
* search path, specified in platform-dependent notation. |
|
678 |
* |
|
679 |
* This call will fail (and fail to remove from the path) if the element still |
|
680 |
* has files open in it. |
|
681 |
* |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
682 |
* \param oldDir dir/archive to remove. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
683 |
* \return nonzero on success, zero on failure. |
1 | 684 |
* Specifics of the error can be gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
685 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
686 |
* \sa PHYSFS_addToSearchPath |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
687 |
* \sa PHYSFS_getSearchPath |
1 | 688 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
689 |
__EXPORT__ int PHYSFS_removeFromSearchPath(const char *oldDir); |
1 | 690 |
|
691 |
||
692 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
693 |
* \fn char **PHYSFS_getSearchPath(void) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
694 |
* \brief Get the current search path. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
695 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
696 |
* The default search path is an empty list. |
1 | 697 |
* |
698 |
* The returned value is an array of strings, with a NULL entry to signify the |
|
699 |
* end of the list: |
|
700 |
* |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
701 |
* \code |
1 | 702 |
* char **i; |
703 |
* |
|
704 |
* for (i = PHYSFS_getSearchPath(); *i != NULL; i++) |
|
705 |
* printf("[%s] is in the search path.\n", *i); |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
706 |
* \endcode |
1 | 707 |
* |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
708 |
* When you are done with the returned information, you may dispose of the |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
709 |
* resources by calling PHYSFS_freeList() with the returned pointer. |
1 | 710 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
711 |
* \return Null-terminated array of null-terminated strings. NULL if there |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
712 |
* was a problem (read: OUT OF MEMORY). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
713 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
714 |
* \sa PHYSFS_addToSearchPath |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
715 |
* \sa PHYSFS_removeFromSearchPath |
1 | 716 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
717 |
__EXPORT__ char **PHYSFS_getSearchPath(void); |
1 | 718 |
|
719 |
||
720 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
721 |
* \fn int PHYSFS_setSaneConfig(const char *organization, const char *appName, const char *archiveExt, int includeCdRoms, int archivesFirst) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
722 |
* \brief Set up sane, default paths. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
723 |
* |
1 | 724 |
* Helper function. |
725 |
* |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
726 |
* The write dir will be set to "userdir/.organization/appName", which is |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
727 |
* created if it doesn't exist. |
1 | 728 |
* |
729 |
* The above is sufficient to make sure your program's configuration directory |
|
730 |
* is separated from other clutter, and platform-independent. The period |
|
731 |
* before "mygame" even hides the directory on Unix systems. |
|
732 |
* |
|
733 |
* The search path will be: |
|
734 |
* |
|
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
735 |
* - The Write Dir (created if it doesn't exist) |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
736 |
* - The Base Dir (PHYSFS_getBaseDir()) |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
737 |
* - All found CD-ROM dirs (optionally) |
1 | 738 |
* |
739 |
* These directories are then searched for files ending with the extension |
|
740 |
* (archiveExt), which, if they are valid and supported archives, will also |
|
741 |
* be added to the search path. If you specified "PKG" for (archiveExt), and |
|
742 |
* there's a file named data.PKG in the base dir, it'll be checked. Archives |
|
743 |
* can either be appended or prepended to the search path in alphabetical |
|
744 |
* order, regardless of which directories they were found in. |
|
745 |
* |
|
746 |
* All of this can be accomplished from the application, but this just does it |
|
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
747 |
* all for you. Feel free to add more to the search path manually, too. |
1 | 748 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
749 |
* \param organization Name of your company/group/etc to be used as a |
101
bd18e17ad6ad
Changed PHYSFS_setSaneConfig()'s behaviour. API BREAKAGE.
Ryan C. Gordon <icculus@icculus.org>
parents:
99
diff
changeset
|
750 |
* dirname, so keep it small, and no-frills. |
bd18e17ad6ad
Changed PHYSFS_setSaneConfig()'s behaviour. API BREAKAGE.
Ryan C. Gordon <icculus@icculus.org>
parents:
99
diff
changeset
|
751 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
752 |
* \param appName Program-specific name of your program, to separate it |
1 | 753 |
* from other programs using PhysicsFS. |
754 |
* |
|
397
12ff23d3d716
Fixed a typo in the documentation.
Ryan C. Gordon <icculus@icculus.org>
parents:
322
diff
changeset
|
755 |
* \param archiveExt File extension used by your program to specify an |
1 | 756 |
* archive. For example, Quake 3 uses "pk3", even though |
757 |
* they are just zipfiles. Specify NULL to not dig out |
|
8
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
758 |
* archives automatically. Do not specify the '.' char; |
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
759 |
* If you want to look for ZIP files, specify "ZIP" and |
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
760 |
* not ".ZIP" ... the archive search is case-insensitive. |
1 | 761 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
762 |
* \param includeCdRoms Non-zero to include CD-ROMs in the search path, and |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
763 |
* (if (archiveExt) != NULL) search them for archives. |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
764 |
* This may cause a significant amount of blocking |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
765 |
* while discs are accessed, and if there are no discs |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
766 |
* in the drive (or even not mounted on Unix systems), |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
767 |
* then they may not be made available anyhow. You may |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
768 |
* want to specify zero and handle the disc setup |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
769 |
* yourself. |
1 | 770 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
771 |
* \param archivesFirst Non-zero to prepend the archives to the search path. |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
772 |
* Zero to append them. Ignored if !(archiveExt). |
101
bd18e17ad6ad
Changed PHYSFS_setSaneConfig()'s behaviour. API BREAKAGE.
Ryan C. Gordon <icculus@icculus.org>
parents:
99
diff
changeset
|
773 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
774 |
* \return nonzero on success, zero on error. Specifics of the error can be |
8
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
775 |
* gleaned from PHYSFS_getLastError(). |
1 | 776 |
*/ |
101
bd18e17ad6ad
Changed PHYSFS_setSaneConfig()'s behaviour. API BREAKAGE.
Ryan C. Gordon <icculus@icculus.org>
parents:
99
diff
changeset
|
777 |
__EXPORT__ int PHYSFS_setSaneConfig(const char *organization, |
bd18e17ad6ad
Changed PHYSFS_setSaneConfig()'s behaviour. API BREAKAGE.
Ryan C. Gordon <icculus@icculus.org>
parents:
99
diff
changeset
|
778 |
const char *appName, |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
779 |
const char *archiveExt, |
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
780 |
int includeCdRoms, |
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
781 |
int archivesFirst); |
1 | 782 |
|
783 |
||
508 | 784 |
/* Directory management stuff ... */ |
785 |
||
1 | 786 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
787 |
* \fn int PHYSFS_mkdir(const char *dirName) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
788 |
* \brief Create a directory. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
789 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
790 |
* This is specified in platform-independent notation in relation to the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
791 |
* write dir. All missing parent directories are also created if they |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
792 |
* don't exist. |
1 | 793 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
794 |
* So if you've got the write dir set to "C:\mygame\writedir" and call |
1 | 795 |
* PHYSFS_mkdir("downloads/maps") then the directories |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
796 |
* "C:\mygame\writedir\downloads" and "C:\mygame\writedir\downloads\maps" |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
797 |
* will be created if possible. If the creation of "maps" fails after we |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
798 |
* have successfully created "downloads", then the function leaves the |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
799 |
* created directory behind and reports failure. |
1 | 800 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
801 |
* \param dirName New dir to create. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
802 |
* \return nonzero on success, zero on error. Specifics of the error can be |
1 | 803 |
* gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
804 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
805 |
* \sa PHYSFS_delete |
1 | 806 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
807 |
__EXPORT__ int PHYSFS_mkdir(const char *dirName); |
1 | 808 |
|
809 |
||
810 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
811 |
* \fn int PHYSFS_delete(const char *filename) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
812 |
* \brief Delete a file or directory. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
813 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
814 |
* (filename) is specified in platform-independent notation in relation to the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
815 |
* write dir. |
1 | 816 |
* |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
817 |
* A directory must be empty before this call can delete it. |
1 | 818 |
* |
137
66bddb94b6e0
Abstracted file deletion, so we don't rely on C library for it anymore.
Ryan C. Gordon <icculus@icculus.org>
parents:
132
diff
changeset
|
819 |
* Deleting a symlink will remove the link, not what it points to, regardless |
66bddb94b6e0
Abstracted file deletion, so we don't rely on C library for it anymore.
Ryan C. Gordon <icculus@icculus.org>
parents:
132
diff
changeset
|
820 |
* of whether you "permitSymLinks" or not. |
66bddb94b6e0
Abstracted file deletion, so we don't rely on C library for it anymore.
Ryan C. Gordon <icculus@icculus.org>
parents:
132
diff
changeset
|
821 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
822 |
* So if you've got the write dir set to "C:\mygame\writedir" and call |
1 | 823 |
* PHYSFS_delete("downloads/maps/level1.map") then the file |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
824 |
* "C:\mygame\writedir\downloads\maps\level1.map" is removed from the |
1 | 825 |
* physical filesystem, if it exists and the operating system permits the |
826 |
* deletion. |
|
827 |
* |
|
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
828 |
* Note that on Unix systems, deleting a file may be successful, but the |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
829 |
* actual file won't be removed until all processes that have an open |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
830 |
* filehandle to it (including your program) close their handles. |
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
831 |
* |
137
66bddb94b6e0
Abstracted file deletion, so we don't rely on C library for it anymore.
Ryan C. Gordon <icculus@icculus.org>
parents:
132
diff
changeset
|
832 |
* Chances are, the bits that make up the file still exist, they are just |
66bddb94b6e0
Abstracted file deletion, so we don't rely on C library for it anymore.
Ryan C. Gordon <icculus@icculus.org>
parents:
132
diff
changeset
|
833 |
* made available to be written over at a later point. Don't consider this |
66bddb94b6e0
Abstracted file deletion, so we don't rely on C library for it anymore.
Ryan C. Gordon <icculus@icculus.org>
parents:
132
diff
changeset
|
834 |
* a security method or anything. :) |
66bddb94b6e0
Abstracted file deletion, so we don't rely on C library for it anymore.
Ryan C. Gordon <icculus@icculus.org>
parents:
132
diff
changeset
|
835 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
836 |
* \param filename Filename to delete. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
837 |
* \return nonzero on success, zero on error. Specifics of the error can be |
1 | 838 |
* gleaned from PHYSFS_getLastError(). |
839 |
*/ |
|
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
840 |
__EXPORT__ int PHYSFS_delete(const char *filename); |
1 | 841 |
|
842 |
||
843 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
844 |
* \fn const char *PHYSFS_getRealDir(const char *filename) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
845 |
* \brief Figure out where in the search path a file resides. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
846 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
847 |
* The file is specified in platform-independent notation. The returned |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
848 |
* filename will be the element of the search path where the file was found, |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
849 |
* which may be a directory, or an archive. Even if there are multiple |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
850 |
* matches in different parts of the search path, only the first one found |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
851 |
* is used, just like when opening a file. |
1 | 852 |
* |
853 |
* So, if you look for "maps/level1.map", and C:\mygame is in your search |
|
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
854 |
* path and C:\mygame\maps\level1.map exists, then "C:\mygame" is returned. |
1 | 855 |
* |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
856 |
* If a any part of a match is a symbolic link, and you've not explicitly |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
857 |
* permitted symlinks, then it will be ignored, and the search for a match |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
858 |
* will continue. |
2
24ba671694af
Fixed typos, expanded documentation, added init and deinit functions, and
Ryan C. Gordon <icculus@icculus.org>
parents:
1
diff
changeset
|
859 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
860 |
* \param filename file to look for. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
861 |
* \return READ ONLY string of element of search path containing the |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
862 |
* the file in question. NULL if not found. |
1 | 863 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
864 |
__EXPORT__ const char *PHYSFS_getRealDir(const char *filename); |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
865 |
|
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
866 |
|
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
867 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
868 |
* \fn char **PHYSFS_enumerateFiles(const char *dir) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
869 |
* \brief Get a file listing of a search path's directory. |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
870 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
871 |
* Matching directories are interpolated. That is, if "C:\mydir" is in the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
872 |
* search path and contains a directory "savegames" that contains "x.sav", |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
873 |
* "y.sav", and "z.sav", and there is also a "C:\userdir" in the search path |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
874 |
* that has a "savegames" subdirectory with "w.sav", then the following code: |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
875 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
876 |
* \code |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
877 |
* char **rc = PHYSFS_enumerateFiles("savegames"); |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
878 |
* char **i; |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
879 |
* |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
880 |
* for (i = rc; *i != NULL; i++) |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
881 |
* printf(" * We've got [%s].\n", *i); |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
882 |
* |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
883 |
* PHYSFS_freeList(rc); |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
884 |
* \endcode |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
885 |
* |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
886 |
* ...will print: |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
887 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
888 |
* \verbatim |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
889 |
* We've got [x.sav]. |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
890 |
* We've got [y.sav]. |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
891 |
* We've got [z.sav]. |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
892 |
* We've got [w.sav].\endverbatim |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
893 |
* |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
894 |
* Feel free to sort the list however you like. We only promise there will |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
895 |
* be no duplicates, but not what order the final list will come back in. |
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
896 |
* |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
897 |
* Don't forget to call PHYSFS_freeList() with the return value from this |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
898 |
* function when you are done with it. |
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
899 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
900 |
* \param dir directory in platform-independent notation to enumerate. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
901 |
* \return Null-terminated array of null-terminated strings. |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
902 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
903 |
__EXPORT__ char **PHYSFS_enumerateFiles(const char *dir); |
1 | 904 |
|
905 |
||
906 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
907 |
* \fn int PHYSFS_exists(const char *fname) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
908 |
* \brief Determine if a file exists in the search path. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
909 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
910 |
* Reports true if there is an entry anywhere in the search path by the |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
911 |
* name of (fname). |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
912 |
* |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
913 |
* Note that entries that are symlinks are ignored if |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
914 |
* PHYSFS_permitSymbolicLinks(1) hasn't been called, so you |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
915 |
* might end up further down in the search path than expected. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
916 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
917 |
* \param fname filename in platform-independent notation. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
918 |
* \return non-zero if filename exists. zero otherwise. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
919 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
920 |
* \sa PHYSFS_isDirectory |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
921 |
* \sa PHYSFS_isSymbolicLink |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
922 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
923 |
__EXPORT__ int PHYSFS_exists(const char *fname); |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
924 |
|
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
925 |
|
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
926 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
927 |
* \fn int PHYSFS_isDirectory(const char *fname) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
928 |
* \brief Determine if a file in the search path is really a directory. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
929 |
* |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
930 |
* Determine if the first occurence of (fname) in the search path is |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
931 |
* really a directory entry. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
932 |
* |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
933 |
* Note that entries that are symlinks are ignored if |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
934 |
* PHYSFS_permitSymbolicLinks(1) hasn't been called, so you |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
935 |
* might end up further down in the search path than expected. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
936 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
937 |
* \param fname filename in platform-independent notation. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
938 |
* \return non-zero if filename exists and is a directory. zero otherwise. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
939 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
940 |
* \sa PHYSFS_exists |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
941 |
* \sa PHYSFS_isSymbolicLink |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
942 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
943 |
__EXPORT__ int PHYSFS_isDirectory(const char *fname); |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
944 |
|
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
945 |
|
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
946 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
947 |
* \fn int PHYSFS_isSymbolicLink(const char *fname) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
948 |
* \brief Determine if a file in the search path is really a symbolic link. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
949 |
* |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
950 |
* Determine if the first occurence of (fname) in the search path is |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
951 |
* really a symbolic link. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
952 |
* |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
953 |
* Note that entries that are symlinks are ignored if |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
954 |
* PHYSFS_permitSymbolicLinks(1) hasn't been called, and as such, |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
955 |
* this function will always return 0 in that case. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
956 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
957 |
* \param fname filename in platform-independent notation. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
958 |
* \return non-zero if filename exists and is a symlink. zero otherwise. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
959 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
960 |
* \sa PHYSFS_exists |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
961 |
* \sa PHYSFS_isDirectory |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
962 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
963 |
__EXPORT__ int PHYSFS_isSymbolicLink(const char *fname); |
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
964 |
|
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
965 |
|
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
966 |
/** |
508 | 967 |
* \fn PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename) |
968 |
* \brief Get the last modification time of a file. |
|
969 |
* |
|
970 |
* The modtime is returned as a number of seconds since the epoch |
|
971 |
* (Jan 1, 1970). The exact derivation and accuracy of this time depends on |
|
972 |
* the particular archiver. If there is no reasonable way to obtain this |
|
973 |
* information for a particular archiver, or there was some sort of error, |
|
974 |
* this function returns (-1). |
|
975 |
* |
|
976 |
* \param filename filename to check, in platform-independent notation. |
|
977 |
* \return last modified time of the file. -1 if it can't be determined. |
|
978 |
*/ |
|
979 |
__EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename); |
|
980 |
||
981 |
||
982 |
/* i/o stuff... */ |
|
983 |
||
984 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
985 |
* \fn PHYSFS_file *PHYSFS_openWrite(const char *filename) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
986 |
* \brief Open a file for writing. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
987 |
* |
1 | 988 |
* Open a file for writing, in platform-independent notation and in relation |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
989 |
* to the write dir as the root of the writable filesystem. The specified |
1 | 990 |
* file is created if it doesn't exist. If it does exist, it is truncated to |
991 |
* zero bytes, and the writing offset is set to the start. |
|
992 |
* |
|
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
993 |
* Note that entries that are symlinks are ignored if |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
994 |
* PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
995 |
* symlink with this function will fail in such a case. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
996 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
997 |
* \param filename File to open. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
998 |
* \return A valid PhysicsFS filehandle on success, NULL on error. Specifics |
1 | 999 |
* of the error can be gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1000 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1001 |
* \sa PHYSFS_openRead |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1002 |
* \sa PHYSFS_openAppend |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1003 |
* \sa PHYSFS_write |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1004 |
* \sa PHYSFS_close |
1 | 1005 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
1006 |
__EXPORT__ PHYSFS_file *PHYSFS_openWrite(const char *filename); |
1 | 1007 |
|
1008 |
||
1009 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1010 |
* \fn PHYSFS_file *PHYSFS_openAppend(const char *filename) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1011 |
* \brief Open a file for appending. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1012 |
* |
1 | 1013 |
* Open a file for writing, in platform-independent notation and in relation |
6
3662cbc014ef
More updates, corrections, clarifications...
Ryan C. Gordon <icculus@icculus.org>
parents:
3
diff
changeset
|
1014 |
* to the write dir as the root of the writable filesystem. The specified |
1 | 1015 |
* file is created if it doesn't exist. If it does exist, the writing offset |
1016 |
* is set to the end of the file, so the first write will be the byte after |
|
1017 |
* the end. |
|
1018 |
* |
|
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
1019 |
* Note that entries that are symlinks are ignored if |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
1020 |
* PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
1021 |
* symlink with this function will fail in such a case. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
1022 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1023 |
* \param filename File to open. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1024 |
* \return A valid PhysicsFS filehandle on success, NULL on error. Specifics |
1 | 1025 |
* of the error can be gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1026 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1027 |
* \sa PHYSFS_openRead |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1028 |
* \sa PHYSFS_openWrite |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1029 |
* \sa PHYSFS_write |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1030 |
* \sa PHYSFS_close |
1 | 1031 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
1032 |
__EXPORT__ PHYSFS_file *PHYSFS_openAppend(const char *filename); |
1 | 1033 |
|
1034 |
||
1035 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1036 |
* \fn PHYSFS_file *PHYSFS_openRead(const char *filename) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1037 |
* \brief Open a file for reading. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1038 |
* |
1 | 1039 |
* Open a file for reading, in platform-independent notation. The search path |
1040 |
* is checked one at a time until a matching file is found, in which case an |
|
1041 |
* abstract filehandle is associated with it, and reading may be done. |
|
1042 |
* The reading offset is set to the first byte of the file. |
|
1043 |
* |
|
15
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
1044 |
* Note that entries that are symlinks are ignored if |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
1045 |
* PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
1046 |
* symlink with this function will fail in such a case. |
418eacc97ac8
Tons of updates. Mostly implemented. Mostly compiling.
Ryan C. Gordon <icculus@icculus.org>
parents:
8
diff
changeset
|
1047 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1048 |
* \param filename File to open. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1049 |
* \return A valid PhysicsFS filehandle on success, NULL on error. Specifics |
1 | 1050 |
* of the error can be gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1051 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1052 |
* \sa PHYSFS_openWrite |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1053 |
* \sa PHYSFS_openAppend |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1054 |
* \sa PHYSFS_read |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1055 |
* \sa PHYSFS_close |
1 | 1056 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
1057 |
__EXPORT__ PHYSFS_file *PHYSFS_openRead(const char *filename); |
1 | 1058 |
|
1059 |
||
1060 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1061 |
* \fn int PHYSFS_close(PHYSFS_file *handle) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1062 |
* \brief Close a PhysicsFS filehandle. |
1 | 1063 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1064 |
* This call is capable of failing if the operating system was buffering |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1065 |
* writes to the physical media, and, now forced to write those changes to |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1066 |
* physical media, can not store the data for some reason. In such a case, |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1067 |
* the filehandle stays open. A well-written program should ALWAYS check the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1068 |
* return value from the close call in addition to every writing call! |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1069 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1070 |
* \param handle handle returned from PHYSFS_open*(). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1071 |
* \return nonzero on success, zero on error. Specifics of the error can be |
1 | 1072 |
* gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1073 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1074 |
* \sa PHYSFS_openRead |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1075 |
* \sa PHYSFS_openWrite |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1076 |
* \sa PHYSFS_openAppend |
1 | 1077 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
1078 |
__EXPORT__ int PHYSFS_close(PHYSFS_file *handle); |
1 | 1079 |
|
1080 |
||
1081 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1082 |
* \fn PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle, void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1083 |
* \brief Read data from a PhysicsFS filehandle |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1084 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1085 |
* The file must be opened for reading. |
1 | 1086 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1087 |
* \param handle handle returned from PHYSFS_openRead(). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1088 |
* \param buffer buffer to store read data into. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1089 |
* \param objSize size in bytes of objects being read from (handle). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1090 |
* \param objCount number of (objSize) objects to read from (handle). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1091 |
* \return number of objects read. PHYSFS_getLastError() can shed light on |
3
0dd785321345
Boatloads of updates to the spec.
Ryan C. Gordon <icculus@icculus.org>
parents:
2
diff
changeset
|
1092 |
* the reason this might be < (objCount), as can PHYSFS_eof(). |
8
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
1093 |
* -1 if complete failure. |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1094 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1095 |
* \sa PHYSFS_eof |
1 | 1096 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1097 |
__EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle, |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1098 |
void *buffer, |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1099 |
PHYSFS_uint32 objSize, |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1100 |
PHYSFS_uint32 objCount); |
1 | 1101 |
|
1102 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1103 |
* \fn PHYSFS_sint64 PHYSFS_write(PHYSFS_file *handle, const void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1104 |
* \brief Write data to a PhysicsFS filehandle |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1105 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1106 |
* The file must be opened for writing. |
1 | 1107 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1108 |
* \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend(). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1109 |
* \param buffer buffer to store read data into. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1110 |
* \param objSize size in bytes of objects being read from (handle). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1111 |
* \param objCount number of (objSize) objects to read from (handle). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1112 |
* \return number of objects written. PHYSFS_getLastError() can shed light on |
8
41e4c6031535
Typo fixes, clarifications, and corrections.
Ryan C. Gordon <icculus@icculus.org>
parents:
6
diff
changeset
|
1113 |
* the reason this might be < (objCount). -1 if complete failure. |
1 | 1114 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1115 |
__EXPORT__ PHYSFS_sint64 PHYSFS_write(PHYSFS_file *handle, |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1116 |
const void *buffer, |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1117 |
PHYSFS_uint32 objSize, |
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1118 |
PHYSFS_uint32 objCount); |
1 | 1119 |
|
508 | 1120 |
|
1121 |
/* File position stuff... */ |
|
1122 |
||
1 | 1123 |
/** |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1124 |
* \fn int PHYSFS_eof(PHYSFS_file *handle) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1125 |
* \brief Check for end-of-file state on a PhysicsFS filehandle. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1126 |
* |
1 | 1127 |
* Determine if the end of file has been reached in a PhysicsFS filehandle. |
1128 |
* |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1129 |
* \param handle handle returned from PHYSFS_openRead(). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1130 |
* \return nonzero if EOF, zero if not. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1131 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1132 |
* \sa PHYSFS_read |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1133 |
* \sa PHYSFS_tell |
1 | 1134 |
*/ |
74
a4a5066fb640
Compiles and runs on Visual C. What an uphill climb THAT was.
Ryan C. Gordon <icculus@icculus.org>
parents:
69
diff
changeset
|
1135 |
__EXPORT__ int PHYSFS_eof(PHYSFS_file *handle); |
1 | 1136 |
|
1137 |
||
1138 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1139 |
* \fn PHYSFS_sint64 PHYSFS_tell(PHYSFS_file *handle) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1140 |
* \brief Determine current position within a PhysicsFS filehandle. |
1 | 1141 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1142 |
* \param handle handle returned from PHYSFS_open*(). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1143 |
* \return offset in bytes from start of file. -1 if error occurred. |
1 | 1144 |
* Specifics of the error can be gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1145 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1146 |
* \sa PHYSFS_seek |
1 | 1147 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1148 |
__EXPORT__ PHYSFS_sint64 PHYSFS_tell(PHYSFS_file *handle); |
1 | 1149 |
|
1150 |
||
1151 |
/** |
|
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1152 |
* \fn int PHYSFS_seek(PHYSFS_file *handle, PHYSFS_uint64 pos) |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1153 |
* \brief Seek to a new position within a PhysicsFS filehandle. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1154 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1155 |
* The next read or write will occur at that place. Seeking past the |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1156 |
* beginning or end of the file is not allowed, and causes an error. |
1 | 1157 |
* |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1158 |
* \param handle handle returned from PHYSFS_open*(). |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1159 |
* \param pos number of bytes from start of file to seek to. |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1160 |
* \return nonzero on success, zero on error. Specifics of the error can be |
1 | 1161 |
* gleaned from PHYSFS_getLastError(). |
265
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1162 |
* |
6187d310b2c0
Lots of tweaks and revisions for Doxygen support.
Ryan C. Gordon <icculus@icculus.org>
parents:
240
diff
changeset
|
1163 |
* \sa PHYSFS_tell |
1 | 1164 |
*/ |
132
b53fa5093749
Added typedefs and platform-specific i/o.
Ryan C. Gordon <icculus@icculus.org>
parents:
128
diff
changeset
|
1165 |
__EXPORT__ int PHYSFS_seek(PHYSFS_file *handle, PHYSFS_uint64 pos); |
2 |