|
1 /** |
|
2 * \file physfs.h |
|
3 * |
|
4 * Main header file for PhysicsFS. |
|
5 */ |
|
6 |
|
7 /** |
|
8 * \mainpage PhysicsFS |
|
9 * |
|
10 * The latest version of PhysicsFS can be found at: |
|
11 * http://icculus.org/physfs/ |
|
12 * |
|
13 * PhysicsFS; a portable, flexible file i/o abstraction. |
|
14 * |
|
15 * This API gives you access to a system file system in ways superior to the |
|
16 * stdio or system i/o calls. The brief benefits: |
|
17 * |
|
18 * - It's portable. |
|
19 * - It's safe. No file access is permitted outside the specified dirs. |
|
20 * - It's flexible. Archives (.ZIP files) can be used transparently as |
|
21 * directory structures. |
|
22 * |
|
23 * This system is largely inspired by Quake 3's PK3 files and the related |
|
24 * fs_* cvars. If you've ever tinkered with these, then this API will be |
|
25 * familiar to you. |
|
26 * |
|
27 * With PhysicsFS, you have a single writing directory and multiple |
|
28 * directories (the "search path") for reading. You can think of this as a |
|
29 * filesystem within a filesystem. If (on Windows) you were to set the |
|
30 * writing directory to "C:\MyGame\MyWritingDirectory", then no PHYSFS calls |
|
31 * could touch anything above this directory, including the "C:\MyGame" and |
|
32 * "C:\" directories. This prevents an application's internal scripting |
|
33 * language from piddling over c:\\config.sys, for example. If you'd rather |
|
34 * give PHYSFS full access to the system's REAL file system, set the writing |
|
35 * dir to "C:\", but that's generally A Bad Thing for several reasons. |
|
36 * |
|
37 * Drive letters are hidden in PhysicsFS once you set up your initial paths. |
|
38 * The search path creates a single, hierarchical directory structure. |
|
39 * Not only does this lend itself well to general abstraction with archives, |
|
40 * it also gives better support to operating systems like MacOS and Unix. |
|
41 * Generally speaking, you shouldn't ever hardcode a drive letter; not only |
|
42 * does this hurt portability to non-Microsoft OSes, but it limits your win32 |
|
43 * users to a single drive, too. Use the PhysicsFS abstraction functions and |
|
44 * allow user-defined configuration options, too. When opening a file, you |
|
45 * specify it like it was on a Unix filesystem: if you want to write to |
|
46 * "C:\MyGame\MyConfigFiles\game.cfg", then you might set the write dir to |
|
47 * "C:\MyGame" and then open "MyConfigFiles/game.cfg". This gives an |
|
48 * abstraction across all platforms. Specifying a file in this way is termed |
|
49 * "platform-independent notation" in this documentation. Specifying a |
|
50 * a filename in a form such as "C:\mydir\myfile" or |
|
51 * "MacOS hard drive:My Directory:My File" is termed "platform-dependent |
|
52 * notation". The only time you use platform-dependent notation is when |
|
53 * setting up your write directory and search path; after that, all file |
|
54 * access into those directories are done with platform-independent notation. |
|
55 * |
|
56 * All files opened for writing are opened in relation to the write directory, |
|
57 * which is the root of the writable filesystem. When opening a file for |
|
58 * reading, PhysicsFS goes through the search path. This is NOT the |
|
59 * same thing as the PATH environment variable. An application using |
|
60 * PhysicsFS specifies directories to be searched which may be actual |
|
61 * directories, or archive files that contain files and subdirectories of |
|
62 * their own. See the end of these docs for currently supported archive |
|
63 * formats. |
|
64 * |
|
65 * Once the search path is defined, you may open files for reading. If you've |
|
66 * got the following search path defined (to use a win32 example again): |
|
67 * |
|
68 * - C:\\mygame |
|
69 * - C:\\mygame\\myuserfiles |
|
70 * - D:\\mygamescdromdatafiles |
|
71 * - C:\\mygame\\installeddatafiles.zip |
|
72 * |
|
73 * Then a call to PHYSFS_openRead("textfiles/myfile.txt") (note the directory |
|
74 * separator, lack of drive letter, and lack of dir separator at the start of |
|
75 * the string; this is platform-independent notation) will check for |
|
76 * C:\\mygame\\textfiles\\myfile.txt, then |
|
77 * C:\\mygame\\myuserfiles\\textfiles\\myfile.txt, then |
|
78 * D:\\mygamescdromdatafiles\\textfiles\\myfile.txt, then, finally, for |
|
79 * textfiles\\myfile.txt inside of C:\\mygame\\installeddatafiles.zip. |
|
80 * Remember that most archive types and platform filesystems store their |
|
81 * filenames in a case-sensitive manner, so you should be careful to specify |
|
82 * it correctly. |
|
83 * |
|
84 * Files opened through PhysicsFS may NOT contain "." or ".." or ":" as dir |
|
85 * elements. Not only are these meaningless on MacOS Classic and/or Unix, |
|
86 * they are a security hole. Also, symbolic links (which can be found in |
|
87 * some archive types and directly in the filesystem on Unix platforms) are |
|
88 * NOT followed until you call PHYSFS_permitSymbolicLinks(). That's left to |
|
89 * your own discretion, as following a symlink can allow for access outside |
|
90 * the write dir and search paths. For portability, there is no mechanism for |
|
91 * creating new symlinks in PhysicsFS. |
|
92 * |
|
93 * The write dir is not included in the search path unless you specifically |
|
94 * add it. While you CAN change the write dir as many times as you like, |
|
95 * you should probably set it once and stick to it. Remember that your |
|
96 * program will not have permission to write in every directory on Unix and |
|
97 * NT systems. |
|
98 * |
|
99 * All files are opened in binary mode; there is no endline conversion for |
|
100 * textfiles. Other than that, PhysicsFS has some convenience functions for |
|
101 * platform-independence. There is a function to tell you the current |
|
102 * platform's dir separator ("\\" on windows, "/" on Unix, ":" on MacOS), |
|
103 * which is needed only to set up your search/write paths. There is a |
|
104 * function to tell you what CD-ROM drives contain accessible discs, and a |
|
105 * function to recommend a good search path, etc. |
|
106 * |
|
107 * A recommended order for the search path is the write dir, then the base dir, |
|
108 * then the cdrom dir, then any archives discovered. Quake 3 does something |
|
109 * like this, but moves the archives to the start of the search path. Build |
|
110 * Engine games, like Duke Nukem 3D and Blood, place the archives last, and |
|
111 * use the base dir for both searching and writing. There is a helper |
|
112 * function (PHYSFS_setSaneConfig()) that puts together a basic configuration |
|
113 * for you, based on a few parameters. Also see the comments on |
|
114 * PHYSFS_getBaseDir(), and PHYSFS_getPrefDir() for info on what those |
|
115 * are and how they can help you determine an optimal search path. |
|
116 * |
|
117 * PhysicsFS 2.0 adds the concept of "mounting" archives to arbitrary points |
|
118 * in the search path. If a zipfile contains "maps/level.map" and you mount |
|
119 * that archive at "mods/mymod", then you would have to open |
|
120 * "mods/mymod/maps/level.map" to access the file, even though "mods/mymod" |
|
121 * isn't actually specified in the .zip file. Unlike the Unix mentality of |
|
122 * mounting a filesystem, "mods/mymod" doesn't actually have to exist when |
|
123 * mounting the zipfile. It's a "virtual" directory. The mounting mechanism |
|
124 * allows the developer to seperate archives in the tree and avoid trampling |
|
125 * over files when added new archives, such as including mod support in a |
|
126 * game...keeping external content on a tight leash in this manner can be of |
|
127 * utmost importance to some applications. |
|
128 * |
|
129 * PhysicsFS is mostly thread safe. The error messages returned by |
|
130 * PHYSFS_getLastError() are unique by thread, and library-state-setting |
|
131 * functions are mutex'd. For efficiency, individual file accesses are |
|
132 * not locked, so you can not safely read/write/seek/close/etc the same |
|
133 * file from two threads at the same time. Other race conditions are bugs |
|
134 * that should be reported/patched. |
|
135 * |
|
136 * While you CAN use stdio/syscall file access in a program that has PHYSFS_* |
|
137 * calls, doing so is not recommended, and you can not use system |
|
138 * filehandles with PhysicsFS and vice versa. |
|
139 * |
|
140 * Note that archives need not be named as such: if you have a ZIP file and |
|
141 * rename it with a .PKG extension, the file will still be recognized as a |
|
142 * ZIP archive by PhysicsFS; the file's contents are used to determine its |
|
143 * type where possible. |
|
144 * |
|
145 * Currently supported archive types: |
|
146 * - .ZIP (pkZip/WinZip/Info-ZIP compatible) |
|
147 * - .7Z (7zip archives) |
|
148 * - .ISO (ISO9660 files, CD-ROM images) |
|
149 * - .GRP (Build Engine groupfile archives) |
|
150 * - .PAK (Quake I/II archive format) |
|
151 * - .HOG (Descent I/II HOG file archives) |
|
152 * - .MVL (Descent II movielib archives) |
|
153 * - .WAD (DOOM engine archives) |
|
154 * |
|
155 * |
|
156 * String policy for PhysicsFS 2.0 and later: |
|
157 * |
|
158 * PhysicsFS 1.0 could only deal with null-terminated ASCII strings. All high |
|
159 * ASCII chars resulted in undefined behaviour, and there was no Unicode |
|
160 * support at all. PhysicsFS 2.0 supports Unicode without breaking binary |
|
161 * compatibility with the 1.0 API by using UTF-8 encoding of all strings |
|
162 * passed in and out of the library. |
|
163 * |
|
164 * All strings passed through PhysicsFS are in null-terminated UTF-8 format. |
|
165 * This means that if all you care about is English (ASCII characters <= 127) |
|
166 * then you just use regular C strings. If you care about Unicode (and you |
|
167 * should!) then you need to figure out what your platform wants, needs, and |
|
168 * offers. If you are on Windows before Win2000 and build with Unicode |
|
169 * support, your TCHAR strings are two bytes per character (this is called |
|
170 * "UCS-2 encoding"). Any modern Windows uses UTF-16, which is two bytes |
|
171 * per character for most characters, but some characters are four. You |
|
172 * should convert them to UTF-8 before handing them to PhysicsFS with |
|
173 * PHYSFS_utf8FromUtf16(), which handles both UTF-16 and UCS-2. If you're |
|
174 * using Unix or Mac OS X, your wchar_t strings are four bytes per character |
|
175 * ("UCS-4 encoding"). Use PHYSFS_utf8FromUcs4(). Mac OS X can give you UTF-8 |
|
176 * directly from a CFString or NSString, and many Unixes generally give you C |
|
177 * strings in UTF-8 format everywhere. If you have a single-byte high ASCII |
|
178 * charset, like so-many European "codepages" you may be out of luck. We'll |
|
179 * convert from "Latin1" to UTF-8 only, and never back to Latin1. If you're |
|
180 * above ASCII 127, all bets are off: move to Unicode or use your platform's |
|
181 * facilities. Passing a C string with high-ASCII data that isn't UTF-8 |
|
182 * encoded will NOT do what you expect! |
|
183 * |
|
184 * Naturally, there's also PHYSFS_utf8ToUcs2(), PHYSFS_utf8ToUtf16(), and |
|
185 * PHYSFS_utf8ToUcs4() to get data back into a format you like. Behind the |
|
186 * scenes, PhysicsFS will use Unicode where possible: the UTF-8 strings on |
|
187 * Windows will be converted and used with the multibyte Windows APIs, for |
|
188 * example. |
|
189 * |
|
190 * PhysicsFS offers basic encoding conversion support, but not a whole string |
|
191 * library. Get your stuff into whatever format you can work with. |
|
192 * |
|
193 * All platforms supported by PhysicsFS 2.1 and later fully support Unicode. |
|
194 * We have dropped platforms that don't (OS/2, Mac OS 9, Windows 95, etc), as |
|
195 * even an OS that's over a decade old should be expected to handle this well. |
|
196 * If you absolutely must support one of these platforms, you should use an |
|
197 * older release of PhysicsFS. |
|
198 * |
|
199 * Many game-specific archivers are seriously unprepared for Unicode (the |
|
200 * Descent HOG/MVL and Build Engine GRP archivers, for example, only offer a |
|
201 * DOS 8.3 filename, for example). Nothing can be done for these, but they |
|
202 * tend to be legacy formats for existing content that was all ASCII (and |
|
203 * thus, valid UTF-8) anyhow. Other formats, like .ZIP, don't explicitly |
|
204 * offer Unicode support, but unofficially expect filenames to be UTF-8 |
|
205 * encoded, and thus Just Work. Most everything does the right thing without |
|
206 * bothering you, but it's good to be aware of these nuances in case they |
|
207 * don't. |
|
208 * |
|
209 * |
|
210 * Other stuff: |
|
211 * |
|
212 * Please see the file LICENSE.txt in the source's root directory for |
|
213 * licensing and redistribution rights. |
|
214 * |
|
215 * Please see the file CREDITS.txt in the source's "docs" directory for |
|
216 * a more or less complete list of who's responsible for this. |
|
217 * |
|
218 * \author Ryan C. Gordon. |
|
219 */ |
|
220 |
|
221 #ifndef _INCLUDE_PHYSFS_H_ |
|
222 #define _INCLUDE_PHYSFS_H_ |
|
223 |
|
224 #ifdef __cplusplus |
|
225 extern "C" { |
|
226 #endif |
|
227 |
|
228 #if defined(PHYSFS_DECL) |
|
229 /* do nothing. */ |
|
230 #elif (defined SWIG) |
|
231 #define PHYSFS_DECL extern |
|
232 #elif (defined _MSC_VER) |
|
233 #define PHYSFS_DECL __declspec(dllexport) |
|
234 #elif (defined __SUNPRO_C) |
|
235 #define PHYSFS_DECL __global |
|
236 #elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun)) |
|
237 #define PHYSFS_DECL __attribute__((visibility("default"))) |
|
238 #else |
|
239 #define PHYSFS_DECL |
|
240 #endif |
|
241 |
|
242 #if defined(PHYSFS_DEPRECATED) |
|
243 /* do nothing. */ |
|
244 #elif (defined SWIG) /* ignore deprecated, since bindings use everything. */ |
|
245 #define PHYSFS_DEPRECATED |
|
246 #elif (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ |
|
247 #define PHYSFS_DEPRECATED __attribute__((deprecated)) |
|
248 #else |
|
249 #define PHYSFS_DEPRECATED |
|
250 #endif |
|
251 |
|
252 #if 0 /* !!! FIXME: look into this later. */ |
|
253 #if defined(PHYSFS_CALL) |
|
254 /* do nothing. */ |
|
255 #elif defined(__WIN32__) && !defined(__GNUC__) |
|
256 #define PHYSFS_CALL __cdecl |
|
257 #else |
|
258 #define PHYSFS_CALL |
|
259 #endif |
|
260 #endif |
|
261 |
|
262 /** |
|
263 * \typedef PHYSFS_uint8 |
|
264 * \brief An unsigned, 8-bit integer type. |
|
265 */ |
|
266 typedef unsigned char PHYSFS_uint8; |
|
267 |
|
268 /** |
|
269 * \typedef PHYSFS_sint8 |
|
270 * \brief A signed, 8-bit integer type. |
|
271 */ |
|
272 typedef signed char PHYSFS_sint8; |
|
273 |
|
274 /** |
|
275 * \typedef PHYSFS_uint16 |
|
276 * \brief An unsigned, 16-bit integer type. |
|
277 */ |
|
278 typedef unsigned short PHYSFS_uint16; |
|
279 |
|
280 /** |
|
281 * \typedef PHYSFS_sint16 |
|
282 * \brief A signed, 16-bit integer type. |
|
283 */ |
|
284 typedef signed short PHYSFS_sint16; |
|
285 |
|
286 /** |
|
287 * \typedef PHYSFS_uint32 |
|
288 * \brief An unsigned, 32-bit integer type. |
|
289 */ |
|
290 typedef unsigned int PHYSFS_uint32; |
|
291 |
|
292 /** |
|
293 * \typedef PHYSFS_sint32 |
|
294 * \brief A signed, 32-bit integer type. |
|
295 */ |
|
296 typedef signed int PHYSFS_sint32; |
|
297 |
|
298 /** |
|
299 * \typedef PHYSFS_uint64 |
|
300 * \brief An unsigned, 64-bit integer type. |
|
301 * \warning on platforms without any sort of 64-bit datatype, this is |
|
302 * equivalent to PHYSFS_uint32! |
|
303 */ |
|
304 |
|
305 /** |
|
306 * \typedef PHYSFS_sint64 |
|
307 * \brief A signed, 64-bit integer type. |
|
308 * \warning on platforms without any sort of 64-bit datatype, this is |
|
309 * equivalent to PHYSFS_sint32! |
|
310 */ |
|
311 |
|
312 |
|
313 #if (defined PHYSFS_NO_64BIT_SUPPORT) /* oh well. */ |
|
314 typedef PHYSFS_uint32 PHYSFS_uint64; |
|
315 typedef PHYSFS_sint32 PHYSFS_sint64; |
|
316 #elif (defined _MSC_VER) |
|
317 typedef signed __int64 PHYSFS_sint64; |
|
318 typedef unsigned __int64 PHYSFS_uint64; |
|
319 #else |
|
320 typedef unsigned long long PHYSFS_uint64; |
|
321 typedef signed long long PHYSFS_sint64; |
|
322 #endif |
|
323 |
|
324 |
|
325 #ifndef SWIG |
|
326 #ifndef DOXYGEN_SHOULD_IGNORE_THIS |
|
327 /* Make sure the types really have the right sizes */ |
|
328 #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \ |
|
329 typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1] |
|
330 |
|
331 PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1); |
|
332 PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1); |
|
333 PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2); |
|
334 PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2); |
|
335 PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4); |
|
336 PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4); |
|
337 |
|
338 #ifndef PHYSFS_NO_64BIT_SUPPORT |
|
339 PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8); |
|
340 PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8); |
|
341 #endif |
|
342 |
|
343 #undef PHYSFS_COMPILE_TIME_ASSERT |
|
344 |
|
345 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
|
346 #endif /* SWIG */ |
|
347 |
|
348 |
|
349 /** |
|
350 * \struct PHYSFS_File |
|
351 * \brief A PhysicsFS file handle. |
|
352 * |
|
353 * You get a pointer to one of these when you open a file for reading, |
|
354 * writing, or appending via PhysicsFS. |
|
355 * |
|
356 * As you can see from the lack of meaningful fields, you should treat this |
|
357 * as opaque data. Don't try to manipulate the file handle, just pass the |
|
358 * pointer you got, unmolested, to various PhysicsFS APIs. |
|
359 * |
|
360 * \sa PHYSFS_openRead |
|
361 * \sa PHYSFS_openWrite |
|
362 * \sa PHYSFS_openAppend |
|
363 * \sa PHYSFS_close |
|
364 * \sa PHYSFS_read |
|
365 * \sa PHYSFS_write |
|
366 * \sa PHYSFS_seek |
|
367 * \sa PHYSFS_tell |
|
368 * \sa PHYSFS_eof |
|
369 * \sa PHYSFS_setBuffer |
|
370 * \sa PHYSFS_flush |
|
371 */ |
|
372 typedef struct PHYSFS_File |
|
373 { |
|
374 void *opaque; /**< That's all you get. Don't touch. */ |
|
375 } PHYSFS_File; |
|
376 |
|
377 |
|
378 /** |
|
379 * \def PHYSFS_file |
|
380 * \brief 1.0 API compatibility define. |
|
381 * |
|
382 * PHYSFS_file is identical to PHYSFS_File. This #define is here for backwards |
|
383 * compatibility with the 1.0 API, which had an inconsistent capitalization |
|
384 * convention in this case. New code should use PHYSFS_File, as this #define |
|
385 * may go away someday. |
|
386 * |
|
387 * \sa PHYSFS_File |
|
388 */ |
|
389 #define PHYSFS_file PHYSFS_File |
|
390 |
|
391 |
|
392 /** |
|
393 * \struct PHYSFS_ArchiveInfo |
|
394 * \brief Information on various PhysicsFS-supported archives. |
|
395 * |
|
396 * This structure gives you details on what sort of archives are supported |
|
397 * by this implementation of PhysicsFS. Archives tend to be things like |
|
398 * ZIP files and such. |
|
399 * |
|
400 * \warning Not all binaries are created equal! PhysicsFS can be built with |
|
401 * or without support for various archives. You can check with |
|
402 * PHYSFS_supportedArchiveTypes() to see if your archive type is |
|
403 * supported. |
|
404 * |
|
405 * \sa PHYSFS_supportedArchiveTypes |
|
406 */ |
|
407 typedef struct PHYSFS_ArchiveInfo |
|
408 { |
|
409 const char *extension; /**< Archive file extension: "ZIP", for example. */ |
|
410 const char *description; /**< Human-readable archive description. */ |
|
411 const char *author; /**< Person who did support for this archive. */ |
|
412 const char *url; /**< URL related to this archive */ |
|
413 } PHYSFS_ArchiveInfo; |
|
414 |
|
415 |
|
416 /** |
|
417 * \struct PHYSFS_Version |
|
418 * \brief Information the version of PhysicsFS in use. |
|
419 * |
|
420 * Represents the library's version as three levels: major revision |
|
421 * (increments with massive changes, additions, and enhancements), |
|
422 * minor revision (increments with backwards-compatible changes to the |
|
423 * major revision), and patchlevel (increments with fixes to the minor |
|
424 * revision). |
|
425 * |
|
426 * \sa PHYSFS_VERSION |
|
427 * \sa PHYSFS_getLinkedVersion |
|
428 */ |
|
429 typedef struct PHYSFS_Version |
|
430 { |
|
431 PHYSFS_uint8 major; /**< major revision */ |
|
432 PHYSFS_uint8 minor; /**< minor revision */ |
|
433 PHYSFS_uint8 patch; /**< patchlevel */ |
|
434 } PHYSFS_Version; |
|
435 |
|
436 |
|
437 #ifndef SWIG /* not available from scripting languages. */ |
|
438 |
|
439 #ifndef DOXYGEN_SHOULD_IGNORE_THIS |
|
440 #define PHYSFS_VER_MAJOR 2 |
|
441 #define PHYSFS_VER_MINOR 1 |
|
442 #define PHYSFS_VER_PATCH 0 |
|
443 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
|
444 |
|
445 |
|
446 /* PhysicsFS state stuff ... */ |
|
447 |
|
448 /** |
|
449 * \def PHYSFS_VERSION(x) |
|
450 * \brief Macro to determine PhysicsFS version program was compiled against. |
|
451 * |
|
452 * This macro fills in a PHYSFS_Version structure with the version of the |
|
453 * library you compiled against. This is determined by what header the |
|
454 * compiler uses. Note that if you dynamically linked the library, you might |
|
455 * have a slightly newer or older version at runtime. That version can be |
|
456 * determined with PHYSFS_getLinkedVersion(), which, unlike PHYSFS_VERSION, |
|
457 * is not a macro. |
|
458 * |
|
459 * \param x A pointer to a PHYSFS_Version struct to initialize. |
|
460 * |
|
461 * \sa PHYSFS_Version |
|
462 * \sa PHYSFS_getLinkedVersion |
|
463 */ |
|
464 #define PHYSFS_VERSION(x) \ |
|
465 { \ |
|
466 (x)->major = PHYSFS_VER_MAJOR; \ |
|
467 (x)->minor = PHYSFS_VER_MINOR; \ |
|
468 (x)->patch = PHYSFS_VER_PATCH; \ |
|
469 } |
|
470 |
|
471 #endif /* SWIG */ |
|
472 |
|
473 |
|
474 /** |
|
475 * \fn void PHYSFS_getLinkedVersion(PHYSFS_Version *ver) |
|
476 * \brief Get the version of PhysicsFS that is linked against your program. |
|
477 * |
|
478 * If you are using a shared library (DLL) version of PhysFS, then it is |
|
479 * possible that it will be different than the version you compiled against. |
|
480 * |
|
481 * This is a real function; the macro PHYSFS_VERSION tells you what version |
|
482 * of PhysFS you compiled against: |
|
483 * |
|
484 * \code |
|
485 * PHYSFS_Version compiled; |
|
486 * PHYSFS_Version linked; |
|
487 * |
|
488 * PHYSFS_VERSION(&compiled); |
|
489 * PHYSFS_getLinkedVersion(&linked); |
|
490 * printf("We compiled against PhysFS version %d.%d.%d ...\n", |
|
491 * compiled.major, compiled.minor, compiled.patch); |
|
492 * printf("But we linked against PhysFS version %d.%d.%d.\n", |
|
493 * linked.major, linked.minor, linked.patch); |
|
494 * \endcode |
|
495 * |
|
496 * This function may be called safely at any time, even before PHYSFS_init(). |
|
497 * |
|
498 * \sa PHYSFS_VERSION |
|
499 */ |
|
500 PHYSFS_DECL void PHYSFS_getLinkedVersion(PHYSFS_Version *ver); |
|
501 |
|
502 |
|
503 /** |
|
504 * \fn int PHYSFS_init(const char *argv0) |
|
505 * \brief Initialize the PhysicsFS library. |
|
506 * |
|
507 * This must be called before any other PhysicsFS function. |
|
508 * |
|
509 * This should be called prior to any attempts to change your process's |
|
510 * current working directory. |
|
511 * |
|
512 * \param argv0 the argv[0] string passed to your program's mainline. |
|
513 * This may be NULL on most platforms (such as ones without a |
|
514 * standard main() function), but you should always try to pass |
|
515 * something in here. Unix-like systems such as Linux _need_ to |
|
516 * pass argv[0] from main() in here. |
|
517 * \return nonzero on success, zero on error. Specifics of the error can be |
|
518 * gleaned from PHYSFS_getLastError(). |
|
519 * |
|
520 * \sa PHYSFS_deinit |
|
521 * \sa PHYSFS_isInit |
|
522 */ |
|
523 PHYSFS_DECL int PHYSFS_init(const char *argv0); |
|
524 |
|
525 |
|
526 /** |
|
527 * \fn int PHYSFS_deinit(void) |
|
528 * \brief Deinitialize the PhysicsFS library. |
|
529 * |
|
530 * This closes any files opened via PhysicsFS, blanks the search/write paths, |
|
531 * frees memory, and invalidates all of your file handles. |
|
532 * |
|
533 * Note that this call can FAIL if there's a file open for writing that |
|
534 * refuses to close (for example, the underlying operating system was |
|
535 * buffering writes to network filesystem, and the fileserver has crashed, |
|
536 * or a hard drive has failed, etc). It is usually best to close all write |
|
537 * handles yourself before calling this function, so that you can gracefully |
|
538 * handle a specific failure. |
|
539 * |
|
540 * Once successfully deinitialized, PHYSFS_init() can be called again to |
|
541 * restart the subsystem. All default API states are restored at this |
|
542 * point, with the exception of any custom allocator you might have |
|
543 * specified, which survives between initializations. |
|
544 * |
|
545 * \return nonzero on success, zero on error. Specifics of the error can be |
|
546 * gleaned from PHYSFS_getLastError(). If failure, state of PhysFS is |
|
547 * undefined, and probably badly screwed up. |
|
548 * |
|
549 * \sa PHYSFS_init |
|
550 * \sa PHYSFS_isInit |
|
551 */ |
|
552 PHYSFS_DECL int PHYSFS_deinit(void); |
|
553 |
|
554 |
|
555 /** |
|
556 * \fn const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void) |
|
557 * \brief Get a list of supported archive types. |
|
558 * |
|
559 * Get a list of archive types supported by this implementation of PhysicFS. |
|
560 * These are the file formats usable for search path entries. This is for |
|
561 * informational purposes only. Note that the extension listed is merely |
|
562 * convention: if we list "ZIP", you can open a PkZip-compatible archive |
|
563 * with an extension of "XYZ", if you like. |
|
564 * |
|
565 * The returned value is an array of pointers to PHYSFS_ArchiveInfo structures, |
|
566 * with a NULL entry to signify the end of the list: |
|
567 * |
|
568 * \code |
|
569 * PHYSFS_ArchiveInfo **i; |
|
570 * |
|
571 * for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++) |
|
572 * { |
|
573 * printf("Supported archive: [%s], which is [%s].\n", |
|
574 * (*i)->extension, (*i)->description); |
|
575 * } |
|
576 * \endcode |
|
577 * |
|
578 * The return values are pointers to internal memory, and should |
|
579 * be considered READ ONLY, and never freed. The returned values are |
|
580 * valid until the next call to PHYSFS_deinit(). |
|
581 * |
|
582 * \return READ ONLY Null-terminated array of READ ONLY structures. |
|
583 */ |
|
584 PHYSFS_DECL const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void); |
|
585 |
|
586 |
|
587 /** |
|
588 * \fn void PHYSFS_freeList(void *listVar) |
|
589 * \brief Deallocate resources of lists returned by PhysicsFS. |
|
590 * |
|
591 * Certain PhysicsFS functions return lists of information that are |
|
592 * dynamically allocated. Use this function to free those resources. |
|
593 * |
|
594 * It is safe to pass a NULL here, but doing so will cause a crash in versions |
|
595 * before PhysicsFS 2.1.0. |
|
596 * |
|
597 * \param listVar List of information specified as freeable by this function. |
|
598 * Passing NULL is safe; it is a valid no-op. |
|
599 * |
|
600 * \sa PHYSFS_getCdRomDirs |
|
601 * \sa PHYSFS_enumerateFiles |
|
602 * \sa PHYSFS_getSearchPath |
|
603 */ |
|
604 PHYSFS_DECL void PHYSFS_freeList(void *listVar); |
|
605 |
|
606 |
|
607 /** |
|
608 * \fn const char *PHYSFS_getLastError(void) |
|
609 * \brief Get human-readable error information. |
|
610 * |
|
611 * \warning As of PhysicsFS 2.1, this function has been nerfed. |
|
612 * Before PhysicsFS 2.1, this function was the only way to get |
|
613 * error details beyond a given function's basic return value. |
|
614 * This was meant to be a human-readable string in one of several |
|
615 * languages, and was not useful for application parsing. This was |
|
616 * a problem, because the developer and not the user chose the |
|
617 * language at compile time, and the PhysicsFS maintainers had |
|
618 * to (poorly) maintain a significant amount of localization work. |
|
619 * The app couldn't parse the strings, even if they counted on a |
|
620 * specific language, since some were dynamically generated. |
|
621 * In 2.1 and later, this always returns a static string in |
|
622 * English; you may use it as a key string for your own |
|
623 * localizations if you like, as we'll promise not to change |
|
624 * existing error strings. Also, if your application wants to |
|
625 * look at specific errors, we now offer a better option: |
|
626 * use PHYSFS_getLastErrorCode() instead. |
|
627 * |
|
628 * Get the last PhysicsFS error message as a human-readable, null-terminated |
|
629 * string. This will return NULL if there's been no error since the last call |
|
630 * to this function. The pointer returned by this call points to an internal |
|
631 * buffer. Each thread has a unique error state associated with it, but each |
|
632 * time a new error message is set, it will overwrite the previous one |
|
633 * associated with that thread. It is safe to call this function at anytime, |
|
634 * even before PHYSFS_init(). |
|
635 * |
|
636 * PHYSFS_getLastError() and PHYSFS_getLastErrorCode() both reset the same |
|
637 * thread-specific error state. Calling one will wipe out the other's |
|
638 * data. If you need both, call PHYSFS_getLastErrorCode(), then pass that |
|
639 * value to PHYSFS_getErrorByCode(). |
|
640 * |
|
641 * As of PhysicsFS 2.1, this function only presents text in the English |
|
642 * language, but the strings are static, so you can use them as keys into |
|
643 * your own localization dictionary. These strings are meant to be passed on |
|
644 * directly to the user. |
|
645 * |
|
646 * Generally, applications should only concern themselves with whether a |
|
647 * given function failed; however, if your code require more specifics, you |
|
648 * should use PHYSFS_getLastErrorCode() instead of this function. |
|
649 * |
|
650 * \return READ ONLY string of last error message. |
|
651 * |
|
652 * \sa PHYSFS_getLastErrorCode |
|
653 * \sa PHYSFS_getErrorByCode |
|
654 */ |
|
655 PHYSFS_DECL const char *PHYSFS_getLastError(void); |
|
656 |
|
657 |
|
658 /** |
|
659 * \fn const char *PHYSFS_getDirSeparator(void) |
|
660 * \brief Get platform-dependent dir separator string. |
|
661 * |
|
662 * This returns "\\" on win32, "/" on Unix, and ":" on MacOS. It may be more |
|
663 * than one character, depending on the platform, and your code should take |
|
664 * that into account. Note that this is only useful for setting up the |
|
665 * search/write paths, since access into those dirs always use '/' |
|
666 * (platform-independent notation) to separate directories. This is also |
|
667 * handy for getting platform-independent access when using stdio calls. |
|
668 * |
|
669 * \return READ ONLY null-terminated string of platform's dir separator. |
|
670 */ |
|
671 PHYSFS_DECL const char *PHYSFS_getDirSeparator(void); |
|
672 |
|
673 |
|
674 /** |
|
675 * \fn void PHYSFS_permitSymbolicLinks(int allow) |
|
676 * \brief Enable or disable following of symbolic links. |
|
677 * |
|
678 * Some physical filesystems and archives contain files that are just pointers |
|
679 * to other files. On the physical filesystem, opening such a link will |
|
680 * (transparently) open the file that is pointed to. |
|
681 * |
|
682 * By default, PhysicsFS will check if a file is really a symlink during open |
|
683 * calls and fail if it is. Otherwise, the link could take you outside the |
|
684 * write and search paths, and compromise security. |
|
685 * |
|
686 * If you want to take that risk, call this function with a non-zero parameter. |
|
687 * Note that this is more for sandboxing a program's scripting language, in |
|
688 * case untrusted scripts try to compromise the system. Generally speaking, |
|
689 * a user could very well have a legitimate reason to set up a symlink, so |
|
690 * unless you feel there's a specific danger in allowing them, you should |
|
691 * permit them. |
|
692 * |
|
693 * Symlinks are only explicitly checked when dealing with filenames |
|
694 * in platform-independent notation. That is, when setting up your |
|
695 * search and write paths, etc, symlinks are never checked for. |
|
696 * |
|
697 * Please note that PHYSFS_stat() will always check the path specified; if |
|
698 * that path is a symlink, it will not be followed in any case. If symlinks |
|
699 * aren't permitted through this function, PHYSFS_stat() ignores them, and |
|
700 * would treat the query as if the path didn't exist at all. |
|
701 * |
|
702 * Symbolic link permission can be enabled or disabled at any time after |
|
703 * you've called PHYSFS_init(), and is disabled by default. |
|
704 * |
|
705 * \param allow nonzero to permit symlinks, zero to deny linking. |
|
706 * |
|
707 * \sa PHYSFS_symbolicLinksPermitted |
|
708 */ |
|
709 PHYSFS_DECL void PHYSFS_permitSymbolicLinks(int allow); |
|
710 |
|
711 |
|
712 /* !!! FIXME: const this? */ |
|
713 /** |
|
714 * \fn char **PHYSFS_getCdRomDirs(void) |
|
715 * \brief Get an array of paths to available CD-ROM drives. |
|
716 * |
|
717 * The dirs returned are platform-dependent ("D:\" on Win32, "/cdrom" or |
|
718 * whatnot on Unix). Dirs are only returned if there is a disc ready and |
|
719 * accessible in the drive. So if you've got two drives (D: and E:), and only |
|
720 * E: has a disc in it, then that's all you get. If the user inserts a disc |
|
721 * in D: and you call this function again, you get both drives. If, on a |
|
722 * Unix box, the user unmounts a disc and remounts it elsewhere, the next |
|
723 * call to this function will reflect that change. |
|
724 * |
|
725 * This function refers to "CD-ROM" media, but it really means "inserted disc |
|
726 * media," such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs. It looks for |
|
727 * filesystems, and as such won't report an audio CD, unless there's a |
|
728 * mounted filesystem track on it. |
|
729 * |
|
730 * The returned value is an array of strings, with a NULL entry to signify the |
|
731 * end of the list: |
|
732 * |
|
733 * \code |
|
734 * char **cds = PHYSFS_getCdRomDirs(); |
|
735 * char **i; |
|
736 * |
|
737 * for (i = cds; *i != NULL; i++) |
|
738 * printf("cdrom dir [%s] is available.\n", *i); |
|
739 * |
|
740 * PHYSFS_freeList(cds); |
|
741 * \endcode |
|
742 * |
|
743 * This call may block while drives spin up. Be forewarned. |
|
744 * |
|
745 * When you are done with the returned information, you may dispose of the |
|
746 * resources by calling PHYSFS_freeList() with the returned pointer. |
|
747 * |
|
748 * \return Null-terminated array of null-terminated strings. |
|
749 * |
|
750 * \sa PHYSFS_getCdRomDirsCallback |
|
751 */ |
|
752 PHYSFS_DECL char **PHYSFS_getCdRomDirs(void); |
|
753 |
|
754 |
|
755 /** |
|
756 * \fn const char *PHYSFS_getBaseDir(void) |
|
757 * \brief Get the path where the application resides. |
|
758 * |
|
759 * Helper function. |
|
760 * |
|
761 * Get the "base dir". This is the directory where the application was run |
|
762 * from, which is probably the installation directory, and may or may not |
|
763 * be the process's current working directory. |
|
764 * |
|
765 * You should probably use the base dir in your search path. |
|
766 * |
|
767 * \return READ ONLY string of base dir in platform-dependent notation. |
|
768 * |
|
769 * \sa PHYSFS_getPrefDir |
|
770 */ |
|
771 PHYSFS_DECL const char *PHYSFS_getBaseDir(void); |
|
772 |
|
773 |
|
774 /** |
|
775 * \fn const char *PHYSFS_getUserDir(void) |
|
776 * \brief Get the path where user's home directory resides. |
|
777 * |
|
778 * \deprecated As of PhysicsFS 2.1, you probably want PHYSFS_getPrefDir(). |
|
779 * |
|
780 * Helper function. |
|
781 * |
|
782 * Get the "user dir". This is meant to be a suggestion of where a specific |
|
783 * user of the system can store files. On Unix, this is her home directory. |
|
784 * On systems with no concept of multiple home directories (MacOS, win95), |
|
785 * this will default to something like "C:\mybasedir\users\username" |
|
786 * where "username" will either be the login name, or "default" if the |
|
787 * platform doesn't support multiple users, either. |
|
788 * |
|
789 * \return READ ONLY string of user dir in platform-dependent notation. |
|
790 * |
|
791 * \sa PHYSFS_getBaseDir |
|
792 * \sa PHYSFS_getPrefDir |
|
793 */ |
|
794 PHYSFS_DECL const char *PHYSFS_getUserDir(void) PHYSFS_DEPRECATED; |
|
795 |
|
796 |
|
797 /** |
|
798 * \fn const char *PHYSFS_getWriteDir(void) |
|
799 * \brief Get path where PhysicsFS will allow file writing. |
|
800 * |
|
801 * Get the current write dir. The default write dir is NULL. |
|
802 * |
|
803 * \return READ ONLY string of write dir in platform-dependent notation, |
|
804 * OR NULL IF NO WRITE PATH IS CURRENTLY SET. |
|
805 * |
|
806 * \sa PHYSFS_setWriteDir |
|
807 */ |
|
808 PHYSFS_DECL const char *PHYSFS_getWriteDir(void); |
|
809 |
|
810 |
|
811 /** |
|
812 * \fn int PHYSFS_setWriteDir(const char *newDir) |
|
813 * \brief Tell PhysicsFS where it may write files. |
|
814 * |
|
815 * Set a new write dir. This will override the previous setting. |
|
816 * |
|
817 * This call will fail (and fail to change the write dir) if the current |
|
818 * write dir still has files open in it. |
|
819 * |
|
820 * \param newDir The new directory to be the root of the write dir, |
|
821 * specified in platform-dependent notation. Setting to NULL |
|
822 * disables the write dir, so no files can be opened for |
|
823 * writing via PhysicsFS. |
|
824 * \return non-zero on success, zero on failure. All attempts to open a file |
|
825 * for writing via PhysicsFS will fail until this call succeeds. |
|
826 * Specifics of the error can be gleaned from PHYSFS_getLastError(). |
|
827 * |
|
828 * \sa PHYSFS_getWriteDir |
|
829 */ |
|
830 PHYSFS_DECL int PHYSFS_setWriteDir(const char *newDir); |
|
831 |
|
832 |
|
833 /** |
|
834 * \fn int PHYSFS_addToSearchPath(const char *newDir, int appendToPath) |
|
835 * \brief Add an archive or directory to the search path. |
|
836 * |
|
837 * \deprecated As of PhysicsFS 2.0, use PHYSFS_mount() instead. This |
|
838 * function just wraps it anyhow. |
|
839 * |
|
840 * This function is equivalent to: |
|
841 * |
|
842 * \code |
|
843 * PHYSFS_mount(newDir, NULL, appendToPath); |
|
844 * \endcode |
|
845 * |
|
846 * You must use this and not PHYSFS_mount if binary compatibility with |
|
847 * PhysicsFS 1.0 is important (which it may not be for many people). |
|
848 * |
|
849 * \sa PHYSFS_mount |
|
850 * \sa PHYSFS_removeFromSearchPath |
|
851 * \sa PHYSFS_getSearchPath |
|
852 */ |
|
853 PHYSFS_DECL int PHYSFS_addToSearchPath(const char *newDir, int appendToPath) |
|
854 PHYSFS_DEPRECATED; |
|
855 |
|
856 /** |
|
857 * \fn int PHYSFS_removeFromSearchPath(const char *oldDir) |
|
858 * \brief Remove a directory or archive from the search path. |
|
859 * |
|
860 * \deprecated As of PhysicsFS 2.1, use PHYSFS_unmount() instead. This |
|
861 * function just wraps it anyhow. There's no functional difference |
|
862 * except the vocabulary changed from "adding to the search path" |
|
863 * to "mounting" when that functionality was extended, and thus |
|
864 * the preferred way to accomplish this function's work is now |
|
865 * called "unmounting." |
|
866 * |
|
867 * This function is equivalent to: |
|
868 * |
|
869 * \code |
|
870 * PHYSFS_unmount(oldDir); |
|
871 * \endcode |
|
872 * |
|
873 * You must use this and not PHYSFS_unmount if binary compatibility with |
|
874 * PhysicsFS 1.0 is important (which it may not be for many people). |
|
875 * |
|
876 * \sa PHYSFS_addToSearchPath |
|
877 * \sa PHYSFS_getSearchPath |
|
878 * \sa PHYSFS_unmount |
|
879 */ |
|
880 PHYSFS_DECL int PHYSFS_removeFromSearchPath(const char *oldDir) |
|
881 PHYSFS_DEPRECATED; |
|
882 |
|
883 |
|
884 /** |
|
885 * \fn char **PHYSFS_getSearchPath(void) |
|
886 * \brief Get the current search path. |
|
887 * |
|
888 * The default search path is an empty list. |
|
889 * |
|
890 * The returned value is an array of strings, with a NULL entry to signify the |
|
891 * end of the list: |
|
892 * |
|
893 * \code |
|
894 * char **i; |
|
895 * |
|
896 * for (i = PHYSFS_getSearchPath(); *i != NULL; i++) |
|
897 * printf("[%s] is in the search path.\n", *i); |
|
898 * \endcode |
|
899 * |
|
900 * When you are done with the returned information, you may dispose of the |
|
901 * resources by calling PHYSFS_freeList() with the returned pointer. |
|
902 * |
|
903 * \return Null-terminated array of null-terminated strings. NULL if there |
|
904 * was a problem (read: OUT OF MEMORY). |
|
905 * |
|
906 * \sa PHYSFS_getSearchPathCallback |
|
907 * \sa PHYSFS_addToSearchPath |
|
908 * \sa PHYSFS_removeFromSearchPath |
|
909 */ |
|
910 PHYSFS_DECL char **PHYSFS_getSearchPath(void); |
|
911 |
|
912 |
|
913 /** |
|
914 * \fn int PHYSFS_setSaneConfig(const char *organization, const char *appName, const char *archiveExt, int includeCdRoms, int archivesFirst) |
|
915 * \brief Set up sane, default paths. |
|
916 * |
|
917 * Helper function. |
|
918 * |
|
919 * The write dir will be set to the pref dir returned by |
|
920 * \code PHYSFS_getPrefDir(organization, appName) \endcode, which is |
|
921 * created if it doesn't exist. |
|
922 * |
|
923 * The above is sufficient to make sure your program's configuration directory |
|
924 * is separated from other clutter, and platform-independent. |
|
925 * |
|
926 * The search path will be: |
|
927 * |
|
928 * - The Write Dir (created if it doesn't exist) |
|
929 * - The Base Dir (PHYSFS_getBaseDir()) |
|
930 * - All found CD-ROM dirs (optionally) |
|
931 * |
|
932 * These directories are then searched for files ending with the extension |
|
933 * (archiveExt), which, if they are valid and supported archives, will also |
|
934 * be added to the search path. If you specified "PKG" for (archiveExt), and |
|
935 * there's a file named data.PKG in the base dir, it'll be checked. Archives |
|
936 * can either be appended or prepended to the search path in alphabetical |
|
937 * order, regardless of which directories they were found in. All archives |
|
938 * are mounted in the root of the virtual file system ("/"). |
|
939 * |
|
940 * All of this can be accomplished from the application, but this just does it |
|
941 * all for you. Feel free to add more to the search path manually, too. |
|
942 * |
|
943 * \param organization Name of your company/group/etc to be used as a |
|
944 * dirname, so keep it small, and no-frills. |
|
945 * |
|
946 * \param appName Program-specific name of your program, to separate it |
|
947 * from other programs using PhysicsFS. |
|
948 * |
|
949 * \param archiveExt File extension used by your program to specify an |
|
950 * archive. For example, Quake 3 uses "pk3", even though |
|
951 * they are just zipfiles. Specify NULL to not dig out |
|
952 * archives automatically. Do not specify the '.' char; |
|
953 * If you want to look for ZIP files, specify "ZIP" and |
|
954 * not ".ZIP" ... the archive search is case-insensitive. |
|
955 * |
|
956 * \param includeCdRoms Non-zero to include CD-ROMs in the search path, and |
|
957 * (if (archiveExt) != NULL) search them for archives. |
|
958 * This may cause a significant amount of blocking |
|
959 * while discs are accessed, and if there are no discs |
|
960 * in the drive (or even not mounted on Unix systems), |
|
961 * then they may not be made available anyhow. You may |
|
962 * want to specify zero and handle the disc setup |
|
963 * yourself. |
|
964 * |
|
965 * \param archivesFirst Non-zero to prepend the archives to the search path. |
|
966 * Zero to append them. Ignored if !(archiveExt). |
|
967 * |
|
968 * \return nonzero on success, zero on error. Specifics of the error can be |
|
969 * gleaned from PHYSFS_getLastError(). |
|
970 */ |
|
971 PHYSFS_DECL int PHYSFS_setSaneConfig(const char *organization, |
|
972 const char *appName, |
|
973 const char *archiveExt, |
|
974 int includeCdRoms, |
|
975 int archivesFirst); |
|
976 |
|
977 |
|
978 /* Directory management stuff ... */ |
|
979 |
|
980 /** |
|
981 * \fn int PHYSFS_mkdir(const char *dirName) |
|
982 * \brief Create a directory. |
|
983 * |
|
984 * This is specified in platform-independent notation in relation to the |
|
985 * write dir. All missing parent directories are also created if they |
|
986 * don't exist. |
|
987 * |
|
988 * So if you've got the write dir set to "C:\mygame\writedir" and call |
|
989 * PHYSFS_mkdir("downloads/maps") then the directories |
|
990 * "C:\mygame\writedir\downloads" and "C:\mygame\writedir\downloads\maps" |
|
991 * will be created if possible. If the creation of "maps" fails after we |
|
992 * have successfully created "downloads", then the function leaves the |
|
993 * created directory behind and reports failure. |
|
994 * |
|
995 * \param dirName New dir to create. |
|
996 * \return nonzero on success, zero on error. Specifics of the error can be |
|
997 * gleaned from PHYSFS_getLastError(). |
|
998 * |
|
999 * \sa PHYSFS_delete |
|
1000 */ |
|
1001 PHYSFS_DECL int PHYSFS_mkdir(const char *dirName); |
|
1002 |
|
1003 |
|
1004 /** |
|
1005 * \fn int PHYSFS_delete(const char *filename) |
|
1006 * \brief Delete a file or directory. |
|
1007 * |
|
1008 * (filename) is specified in platform-independent notation in relation to the |
|
1009 * write dir. |
|
1010 * |
|
1011 * A directory must be empty before this call can delete it. |
|
1012 * |
|
1013 * Deleting a symlink will remove the link, not what it points to, regardless |
|
1014 * of whether you "permitSymLinks" or not. |
|
1015 * |
|
1016 * So if you've got the write dir set to "C:\mygame\writedir" and call |
|
1017 * PHYSFS_delete("downloads/maps/level1.map") then the file |
|
1018 * "C:\mygame\writedir\downloads\maps\level1.map" is removed from the |
|
1019 * physical filesystem, if it exists and the operating system permits the |
|
1020 * deletion. |
|
1021 * |
|
1022 * Note that on Unix systems, deleting a file may be successful, but the |
|
1023 * actual file won't be removed until all processes that have an open |
|
1024 * filehandle to it (including your program) close their handles. |
|
1025 * |
|
1026 * Chances are, the bits that make up the file still exist, they are just |
|
1027 * made available to be written over at a later point. Don't consider this |
|
1028 * a security method or anything. :) |
|
1029 * |
|
1030 * \param filename Filename to delete. |
|
1031 * \return nonzero on success, zero on error. Specifics of the error can be |
|
1032 * gleaned from PHYSFS_getLastError(). |
|
1033 */ |
|
1034 PHYSFS_DECL int PHYSFS_delete(const char *filename); |
|
1035 |
|
1036 |
|
1037 /** |
|
1038 * \fn const char *PHYSFS_getRealDir(const char *filename) |
|
1039 * \brief Figure out where in the search path a file resides. |
|
1040 * |
|
1041 * The file is specified in platform-independent notation. The returned |
|
1042 * filename will be the element of the search path where the file was found, |
|
1043 * which may be a directory, or an archive. Even if there are multiple |
|
1044 * matches in different parts of the search path, only the first one found |
|
1045 * is used, just like when opening a file. |
|
1046 * |
|
1047 * So, if you look for "maps/level1.map", and C:\\mygame is in your search |
|
1048 * path and C:\\mygame\\maps\\level1.map exists, then "C:\mygame" is returned. |
|
1049 * |
|
1050 * If a any part of a match is a symbolic link, and you've not explicitly |
|
1051 * permitted symlinks, then it will be ignored, and the search for a match |
|
1052 * will continue. |
|
1053 * |
|
1054 * If you specify a fake directory that only exists as a mount point, it'll |
|
1055 * be associated with the first archive mounted there, even though that |
|
1056 * directory isn't necessarily contained in a real archive. |
|
1057 * |
|
1058 * \warning This will return NULL if there is no real directory associated |
|
1059 * with (filename). Specifically, PHYSFS_mountIo(), |
|
1060 * PHYSFS_mountMemory(), and PHYSFS_mountHandle() will return NULL |
|
1061 * even if the filename is found in the search path. Plan accordingly. |
|
1062 * |
|
1063 * \param filename file to look for. |
|
1064 * \return READ ONLY string of element of search path containing the |
|
1065 * the file in question. NULL if not found. |
|
1066 */ |
|
1067 PHYSFS_DECL const char *PHYSFS_getRealDir(const char *filename); |
|
1068 |
|
1069 |
|
1070 /** |
|
1071 * \fn char **PHYSFS_enumerateFiles(const char *dir) |
|
1072 * \brief Get a file listing of a search path's directory. |
|
1073 * |
|
1074 * Matching directories are interpolated. That is, if "C:\mydir" is in the |
|
1075 * search path and contains a directory "savegames" that contains "x.sav", |
|
1076 * "y.sav", and "z.sav", and there is also a "C:\userdir" in the search path |
|
1077 * that has a "savegames" subdirectory with "w.sav", then the following code: |
|
1078 * |
|
1079 * \code |
|
1080 * char **rc = PHYSFS_enumerateFiles("savegames"); |
|
1081 * char **i; |
|
1082 * |
|
1083 * for (i = rc; *i != NULL; i++) |
|
1084 * printf(" * We've got [%s].\n", *i); |
|
1085 * |
|
1086 * PHYSFS_freeList(rc); |
|
1087 * \endcode |
|
1088 * |
|
1089 * \...will print: |
|
1090 * |
|
1091 * \verbatim |
|
1092 * We've got [x.sav]. |
|
1093 * We've got [y.sav]. |
|
1094 * We've got [z.sav]. |
|
1095 * We've got [w.sav].\endverbatim |
|
1096 * |
|
1097 * Feel free to sort the list however you like. We only promise there will |
|
1098 * be no duplicates, but not what order the final list will come back in. |
|
1099 * |
|
1100 * Don't forget to call PHYSFS_freeList() with the return value from this |
|
1101 * function when you are done with it. |
|
1102 * |
|
1103 * \param dir directory in platform-independent notation to enumerate. |
|
1104 * \return Null-terminated array of null-terminated strings. |
|
1105 * |
|
1106 * \sa PHYSFS_enumerateFilesCallback |
|
1107 */ |
|
1108 PHYSFS_DECL char **PHYSFS_enumerateFiles(const char *dir); |
|
1109 |
|
1110 |
|
1111 /** |
|
1112 * \fn int PHYSFS_exists(const char *fname) |
|
1113 * \brief Determine if a file exists in the search path. |
|
1114 * |
|
1115 * Reports true if there is an entry anywhere in the search path by the |
|
1116 * name of (fname). |
|
1117 * |
|
1118 * Note that entries that are symlinks are ignored if |
|
1119 * PHYSFS_permitSymbolicLinks(1) hasn't been called, so you |
|
1120 * might end up further down in the search path than expected. |
|
1121 * |
|
1122 * \param fname filename in platform-independent notation. |
|
1123 * \return non-zero if filename exists. zero otherwise. |
|
1124 */ |
|
1125 PHYSFS_DECL int PHYSFS_exists(const char *fname); |
|
1126 |
|
1127 |
|
1128 /** |
|
1129 * \fn int PHYSFS_isDirectory(const char *fname) |
|
1130 * \brief Determine if a file in the search path is really a directory. |
|
1131 * |
|
1132 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This |
|
1133 * function just wraps it anyhow. |
|
1134 * |
|
1135 * Determine if the first occurence of (fname) in the search path is |
|
1136 * really a directory entry. |
|
1137 * |
|
1138 * Note that entries that are symlinks are ignored if |
|
1139 * PHYSFS_permitSymbolicLinks(1) hasn't been called, so you |
|
1140 * might end up further down in the search path than expected. |
|
1141 * |
|
1142 * \param fname filename in platform-independent notation. |
|
1143 * \return non-zero if filename exists and is a directory. zero otherwise. |
|
1144 * |
|
1145 * \sa PHYSFS_stat |
|
1146 * \sa PHYSFS_exists |
|
1147 */ |
|
1148 PHYSFS_DECL int PHYSFS_isDirectory(const char *fname) PHYSFS_DEPRECATED; |
|
1149 |
|
1150 |
|
1151 /** |
|
1152 * \fn int PHYSFS_isSymbolicLink(const char *fname) |
|
1153 * \brief Determine if a file in the search path is really a symbolic link. |
|
1154 * |
|
1155 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This |
|
1156 * function just wraps it anyhow. |
|
1157 * |
|
1158 * Determine if the first occurence of (fname) in the search path is |
|
1159 * really a symbolic link. |
|
1160 * |
|
1161 * Note that entries that are symlinks are ignored if |
|
1162 * PHYSFS_permitSymbolicLinks(1) hasn't been called, and as such, |
|
1163 * this function will always return 0 in that case. |
|
1164 * |
|
1165 * \param fname filename in platform-independent notation. |
|
1166 * \return non-zero if filename exists and is a symlink. zero otherwise. |
|
1167 * |
|
1168 * \sa PHYSFS_stat |
|
1169 * \sa PHYSFS_exists |
|
1170 */ |
|
1171 PHYSFS_DECL int PHYSFS_isSymbolicLink(const char *fname) PHYSFS_DEPRECATED; |
|
1172 |
|
1173 |
|
1174 /** |
|
1175 * \fn PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename) |
|
1176 * \brief Get the last modification time of a file. |
|
1177 * |
|
1178 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This |
|
1179 * function just wraps it anyhow. |
|
1180 * |
|
1181 * The modtime is returned as a number of seconds since the Unix epoch |
|
1182 * (midnight, Jan 1, 1970). The exact derivation and accuracy of this time |
|
1183 * depends on the particular archiver. If there is no reasonable way to |
|
1184 * obtain this information for a particular archiver, or there was some sort |
|
1185 * of error, this function returns (-1). |
|
1186 * |
|
1187 * You must use this and not PHYSFS_stat() if binary compatibility with |
|
1188 * PhysicsFS 2.0 is important (which it may not be for many people). |
|
1189 * |
|
1190 * \param filename filename to check, in platform-independent notation. |
|
1191 * \return last modified time of the file. -1 if it can't be determined. |
|
1192 * |
|
1193 * \sa PHYSFS_stat |
|
1194 */ |
|
1195 PHYSFS_DECL PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename) |
|
1196 PHYSFS_DEPRECATED; |
|
1197 |
|
1198 |
|
1199 /* i/o stuff... */ |
|
1200 |
|
1201 /** |
|
1202 * \fn PHYSFS_File *PHYSFS_openWrite(const char *filename) |
|
1203 * \brief Open a file for writing. |
|
1204 * |
|
1205 * Open a file for writing, in platform-independent notation and in relation |
|
1206 * to the write dir as the root of the writable filesystem. The specified |
|
1207 * file is created if it doesn't exist. If it does exist, it is truncated to |
|
1208 * zero bytes, and the writing offset is set to the start. |
|
1209 * |
|
1210 * Note that entries that are symlinks are ignored if |
|
1211 * PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a |
|
1212 * symlink with this function will fail in such a case. |
|
1213 * |
|
1214 * \param filename File to open. |
|
1215 * \return A valid PhysicsFS filehandle on success, NULL on error. Specifics |
|
1216 * of the error can be gleaned from PHYSFS_getLastError(). |
|
1217 * |
|
1218 * \sa PHYSFS_openRead |
|
1219 * \sa PHYSFS_openAppend |
|
1220 * \sa PHYSFS_write |
|
1221 * \sa PHYSFS_close |
|
1222 */ |
|
1223 PHYSFS_DECL PHYSFS_File *PHYSFS_openWrite(const char *filename); |
|
1224 |
|
1225 |
|
1226 /** |
|
1227 * \fn PHYSFS_File *PHYSFS_openAppend(const char *filename) |
|
1228 * \brief Open a file for appending. |
|
1229 * |
|
1230 * Open a file for writing, in platform-independent notation and in relation |
|
1231 * to the write dir as the root of the writable filesystem. The specified |
|
1232 * file is created if it doesn't exist. If it does exist, the writing offset |
|
1233 * is set to the end of the file, so the first write will be the byte after |
|
1234 * the end. |
|
1235 * |
|
1236 * Note that entries that are symlinks are ignored if |
|
1237 * PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a |
|
1238 * symlink with this function will fail in such a case. |
|
1239 * |
|
1240 * \param filename File to open. |
|
1241 * \return A valid PhysicsFS filehandle on success, NULL on error. Specifics |
|
1242 * of the error can be gleaned from PHYSFS_getLastError(). |
|
1243 * |
|
1244 * \sa PHYSFS_openRead |
|
1245 * \sa PHYSFS_openWrite |
|
1246 * \sa PHYSFS_write |
|
1247 * \sa PHYSFS_close |
|
1248 */ |
|
1249 PHYSFS_DECL PHYSFS_File *PHYSFS_openAppend(const char *filename); |
|
1250 |
|
1251 |
|
1252 /** |
|
1253 * \fn PHYSFS_File *PHYSFS_openRead(const char *filename) |
|
1254 * \brief Open a file for reading. |
|
1255 * |
|
1256 * Open a file for reading, in platform-independent notation. The search path |
|
1257 * is checked one at a time until a matching file is found, in which case an |
|
1258 * abstract filehandle is associated with it, and reading may be done. |
|
1259 * The reading offset is set to the first byte of the file. |
|
1260 * |
|
1261 * Note that entries that are symlinks are ignored if |
|
1262 * PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a |
|
1263 * symlink with this function will fail in such a case. |
|
1264 * |
|
1265 * \param filename File to open. |
|
1266 * \return A valid PhysicsFS filehandle on success, NULL on error. Specifics |
|
1267 * of the error can be gleaned from PHYSFS_getLastError(). |
|
1268 * |
|
1269 * \sa PHYSFS_openWrite |
|
1270 * \sa PHYSFS_openAppend |
|
1271 * \sa PHYSFS_read |
|
1272 * \sa PHYSFS_close |
|
1273 */ |
|
1274 PHYSFS_DECL PHYSFS_File *PHYSFS_openRead(const char *filename); |
|
1275 |
|
1276 |
|
1277 /** |
|
1278 * \fn int PHYSFS_close(PHYSFS_File *handle) |
|
1279 * \brief Close a PhysicsFS filehandle. |
|
1280 * |
|
1281 * This call is capable of failing if the operating system was buffering |
|
1282 * writes to the physical media, and, now forced to write those changes to |
|
1283 * physical media, can not store the data for some reason. In such a case, |
|
1284 * the filehandle stays open. A well-written program should ALWAYS check the |
|
1285 * return value from the close call in addition to every writing call! |
|
1286 * |
|
1287 * \param handle handle returned from PHYSFS_open*(). |
|
1288 * \return nonzero on success, zero on error. Specifics of the error can be |
|
1289 * gleaned from PHYSFS_getLastError(). |
|
1290 * |
|
1291 * \sa PHYSFS_openRead |
|
1292 * \sa PHYSFS_openWrite |
|
1293 * \sa PHYSFS_openAppend |
|
1294 */ |
|
1295 PHYSFS_DECL int PHYSFS_close(PHYSFS_File *handle); |
|
1296 |
|
1297 |
|
1298 /** |
|
1299 * \fn PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) |
|
1300 * \brief Read data from a PhysicsFS filehandle |
|
1301 * |
|
1302 * The file must be opened for reading. |
|
1303 * |
|
1304 * \deprecated As of PhysicsFS 2.1, use PHYSFS_readBytes() instead. This |
|
1305 * function just wraps it anyhow. This function never clarified |
|
1306 * what would happen if you managed to read a partial object, so |
|
1307 * working at the byte level makes this cleaner for everyone, |
|
1308 * especially now that PHYSFS_Io interfaces can be supplied by the |
|
1309 * application. |
|
1310 * |
|
1311 * \param handle handle returned from PHYSFS_openRead(). |
|
1312 * \param buffer buffer to store read data into. |
|
1313 * \param objSize size in bytes of objects being read from (handle). |
|
1314 * \param objCount number of (objSize) objects to read from (handle). |
|
1315 * \return number of objects read. PHYSFS_getLastError() can shed light on |
|
1316 * the reason this might be < (objCount), as can PHYSFS_eof(). |
|
1317 * -1 if complete failure. |
|
1318 * |
|
1319 * \sa PHYSFS_readBytes |
|
1320 * \sa PHYSFS_eof |
|
1321 */ |
|
1322 PHYSFS_DECL PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, |
|
1323 void *buffer, |
|
1324 PHYSFS_uint32 objSize, |
|
1325 PHYSFS_uint32 objCount) |
|
1326 PHYSFS_DEPRECATED; |
|
1327 |
|
1328 /** |
|
1329 * \fn PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, const void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) |
|
1330 * \brief Write data to a PhysicsFS filehandle |
|
1331 * |
|
1332 * The file must be opened for writing. |
|
1333 * |
|
1334 * \deprecated As of PhysicsFS 2.1, use PHYSFS_writeBytes() instead. This |
|
1335 * function just wraps it anyhow. This function never clarified |
|
1336 * what would happen if you managed to write a partial object, so |
|
1337 * working at the byte level makes this cleaner for everyone, |
|
1338 * especially now that PHYSFS_Io interfaces can be supplied by the |
|
1339 * application. |
|
1340 * |
|
1341 * \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend(). |
|
1342 * \param buffer buffer of bytes to write to (handle). |
|
1343 * \param objSize size in bytes of objects being written to (handle). |
|
1344 * \param objCount number of (objSize) objects to write to (handle). |
|
1345 * \return number of objects written. PHYSFS_getLastError() can shed light on |
|
1346 * the reason this might be < (objCount). -1 if complete failure. |
|
1347 * |
|
1348 * \sa PHYSFS_writeBytes |
|
1349 */ |
|
1350 PHYSFS_DECL PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, |
|
1351 const void *buffer, |
|
1352 PHYSFS_uint32 objSize, |
|
1353 PHYSFS_uint32 objCount) |
|
1354 PHYSFS_DEPRECATED; |
|
1355 |
|
1356 |
|
1357 /* File position stuff... */ |
|
1358 |
|
1359 /** |
|
1360 * \fn int PHYSFS_eof(PHYSFS_File *handle) |
|
1361 * \brief Check for end-of-file state on a PhysicsFS filehandle. |
|
1362 * |
|
1363 * Determine if the end of file has been reached in a PhysicsFS filehandle. |
|
1364 * |
|
1365 * \param handle handle returned from PHYSFS_openRead(). |
|
1366 * \return nonzero if EOF, zero if not. |
|
1367 * |
|
1368 * \sa PHYSFS_read |
|
1369 * \sa PHYSFS_tell |
|
1370 */ |
|
1371 PHYSFS_DECL int PHYSFS_eof(PHYSFS_File *handle); |
|
1372 |
|
1373 |
|
1374 /** |
|
1375 * \fn PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle) |
|
1376 * \brief Determine current position within a PhysicsFS filehandle. |
|
1377 * |
|
1378 * \param handle handle returned from PHYSFS_open*(). |
|
1379 * \return offset in bytes from start of file. -1 if error occurred. |
|
1380 * Specifics of the error can be gleaned from PHYSFS_getLastError(). |
|
1381 * |
|
1382 * \sa PHYSFS_seek |
|
1383 */ |
|
1384 PHYSFS_DECL PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle); |
|
1385 |
|
1386 |
|
1387 /** |
|
1388 * \fn int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos) |
|
1389 * \brief Seek to a new position within a PhysicsFS filehandle. |
|
1390 * |
|
1391 * The next read or write will occur at that place. Seeking past the |
|
1392 * beginning or end of the file is not allowed, and causes an error. |
|
1393 * |
|
1394 * \param handle handle returned from PHYSFS_open*(). |
|
1395 * \param pos number of bytes from start of file to seek to. |
|
1396 * \return nonzero on success, zero on error. Specifics of the error can be |
|
1397 * gleaned from PHYSFS_getLastError(). |
|
1398 * |
|
1399 * \sa PHYSFS_tell |
|
1400 */ |
|
1401 PHYSFS_DECL int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos); |
|
1402 |
|
1403 |
|
1404 /** |
|
1405 * \fn PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle) |
|
1406 * \brief Get total length of a file in bytes. |
|
1407 * |
|
1408 * Note that if another process/thread is writing to this file at the same |
|
1409 * time, then the information this function supplies could be incorrect |
|
1410 * before you get it. Use with caution, or better yet, don't use at all. |
|
1411 * |
|
1412 * \param handle handle returned from PHYSFS_open*(). |
|
1413 * \return size in bytes of the file. -1 if can't be determined. |
|
1414 * |
|
1415 * \sa PHYSFS_tell |
|
1416 * \sa PHYSFS_seek |
|
1417 */ |
|
1418 PHYSFS_DECL PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle); |
|
1419 |
|
1420 |
|
1421 /* Buffering stuff... */ |
|
1422 |
|
1423 /** |
|
1424 * \fn int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize) |
|
1425 * \brief Set up buffering for a PhysicsFS file handle. |
|
1426 * |
|
1427 * Define an i/o buffer for a file handle. A memory block of (bufsize) bytes |
|
1428 * will be allocated and associated with (handle). |
|
1429 * |
|
1430 * For files opened for reading, up to (bufsize) bytes are read from (handle) |
|
1431 * and stored in the internal buffer. Calls to PHYSFS_read() will pull |
|
1432 * from this buffer until it is empty, and then refill it for more reading. |
|
1433 * Note that compressed files, like ZIP archives, will decompress while |
|
1434 * buffering, so this can be handy for offsetting CPU-intensive operations. |
|
1435 * The buffer isn't filled until you do your next read. |
|
1436 * |
|
1437 * For files opened for writing, data will be buffered to memory until the |
|
1438 * buffer is full or the buffer is flushed. Closing a handle implicitly |
|
1439 * causes a flush...check your return values! |
|
1440 * |
|
1441 * Seeking, etc transparently accounts for buffering. |
|
1442 * |
|
1443 * You can resize an existing buffer by calling this function more than once |
|
1444 * on the same file. Setting the buffer size to zero will free an existing |
|
1445 * buffer. |
|
1446 * |
|
1447 * PhysicsFS file handles are unbuffered by default. |
|
1448 * |
|
1449 * Please check the return value of this function! Failures can include |
|
1450 * not being able to seek backwards in a read-only file when removing the |
|
1451 * buffer, not being able to allocate the buffer, and not being able to |
|
1452 * flush the buffer to disk, among other unexpected problems. |
|
1453 * |
|
1454 * \param handle handle returned from PHYSFS_open*(). |
|
1455 * \param bufsize size, in bytes, of buffer to allocate. |
|
1456 * \return nonzero if successful, zero on error. |
|
1457 * |
|
1458 * \sa PHYSFS_flush |
|
1459 * \sa PHYSFS_read |
|
1460 * \sa PHYSFS_write |
|
1461 * \sa PHYSFS_close |
|
1462 */ |
|
1463 PHYSFS_DECL int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize); |
|
1464 |
|
1465 |
|
1466 /** |
|
1467 * \fn int PHYSFS_flush(PHYSFS_File *handle) |
|
1468 * \brief Flush a buffered PhysicsFS file handle. |
|
1469 * |
|
1470 * For buffered files opened for writing, this will put the current contents |
|
1471 * of the buffer to disk and flag the buffer as empty if possible. |
|
1472 * |
|
1473 * For buffered files opened for reading or unbuffered files, this is a safe |
|
1474 * no-op, and will report success. |
|
1475 * |
|
1476 * \param handle handle returned from PHYSFS_open*(). |
|
1477 * \return nonzero if successful, zero on error. |
|
1478 * |
|
1479 * \sa PHYSFS_setBuffer |
|
1480 * \sa PHYSFS_close |
|
1481 */ |
|
1482 PHYSFS_DECL int PHYSFS_flush(PHYSFS_File *handle); |
|
1483 |
|
1484 |
|
1485 /* Byteorder stuff... */ |
|
1486 |
|
1487 #ifndef SWIG /* not available from scripting languages. */ |
|
1488 |
|
1489 /** |
|
1490 * \fn PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val) |
|
1491 * \brief Swap littleendian signed 16 to platform's native byte order. |
|
1492 * |
|
1493 * Take a 16-bit signed value in littleendian format and convert it to |
|
1494 * the platform's native byte order. |
|
1495 * |
|
1496 * \param val value to convert |
|
1497 * \return converted value. |
|
1498 */ |
|
1499 PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val); |
|
1500 |
|
1501 |
|
1502 /** |
|
1503 * \fn PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val) |
|
1504 * \brief Swap littleendian unsigned 16 to platform's native byte order. |
|
1505 * |
|
1506 * Take a 16-bit unsigned value in littleendian format and convert it to |
|
1507 * the platform's native byte order. |
|
1508 * |
|
1509 * \param val value to convert |
|
1510 * \return converted value. |
|
1511 */ |
|
1512 PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val); |
|
1513 |
|
1514 /** |
|
1515 * \fn PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val) |
|
1516 * \brief Swap littleendian signed 32 to platform's native byte order. |
|
1517 * |
|
1518 * Take a 32-bit signed value in littleendian format and convert it to |
|
1519 * the platform's native byte order. |
|
1520 * |
|
1521 * \param val value to convert |
|
1522 * \return converted value. |
|
1523 */ |
|
1524 PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val); |
|
1525 |
|
1526 |
|
1527 /** |
|
1528 * \fn PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val) |
|
1529 * \brief Swap littleendian unsigned 32 to platform's native byte order. |
|
1530 * |
|
1531 * Take a 32-bit unsigned value in littleendian format and convert it to |
|
1532 * the platform's native byte order. |
|
1533 * |
|
1534 * \param val value to convert |
|
1535 * \return converted value. |
|
1536 */ |
|
1537 PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val); |
|
1538 |
|
1539 /** |
|
1540 * \fn PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val) |
|
1541 * \brief Swap littleendian signed 64 to platform's native byte order. |
|
1542 * |
|
1543 * Take a 64-bit signed value in littleendian format and convert it to |
|
1544 * the platform's native byte order. |
|
1545 * |
|
1546 * \param val value to convert |
|
1547 * \return converted value. |
|
1548 * |
|
1549 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
1550 * any sort of 64-bit support. |
|
1551 */ |
|
1552 PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val); |
|
1553 |
|
1554 |
|
1555 /** |
|
1556 * \fn PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val) |
|
1557 * \brief Swap littleendian unsigned 64 to platform's native byte order. |
|
1558 * |
|
1559 * Take a 64-bit unsigned value in littleendian format and convert it to |
|
1560 * the platform's native byte order. |
|
1561 * |
|
1562 * \param val value to convert |
|
1563 * \return converted value. |
|
1564 * |
|
1565 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
1566 * any sort of 64-bit support. |
|
1567 */ |
|
1568 PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val); |
|
1569 |
|
1570 |
|
1571 /** |
|
1572 * \fn PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val) |
|
1573 * \brief Swap bigendian signed 16 to platform's native byte order. |
|
1574 * |
|
1575 * Take a 16-bit signed value in bigendian format and convert it to |
|
1576 * the platform's native byte order. |
|
1577 * |
|
1578 * \param val value to convert |
|
1579 * \return converted value. |
|
1580 */ |
|
1581 PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val); |
|
1582 |
|
1583 |
|
1584 /** |
|
1585 * \fn PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val) |
|
1586 * \brief Swap bigendian unsigned 16 to platform's native byte order. |
|
1587 * |
|
1588 * Take a 16-bit unsigned value in bigendian format and convert it to |
|
1589 * the platform's native byte order. |
|
1590 * |
|
1591 * \param val value to convert |
|
1592 * \return converted value. |
|
1593 */ |
|
1594 PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val); |
|
1595 |
|
1596 /** |
|
1597 * \fn PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val) |
|
1598 * \brief Swap bigendian signed 32 to platform's native byte order. |
|
1599 * |
|
1600 * Take a 32-bit signed value in bigendian format and convert it to |
|
1601 * the platform's native byte order. |
|
1602 * |
|
1603 * \param val value to convert |
|
1604 * \return converted value. |
|
1605 */ |
|
1606 PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val); |
|
1607 |
|
1608 |
|
1609 /** |
|
1610 * \fn PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val) |
|
1611 * \brief Swap bigendian unsigned 32 to platform's native byte order. |
|
1612 * |
|
1613 * Take a 32-bit unsigned value in bigendian format and convert it to |
|
1614 * the platform's native byte order. |
|
1615 * |
|
1616 * \param val value to convert |
|
1617 * \return converted value. |
|
1618 */ |
|
1619 PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val); |
|
1620 |
|
1621 |
|
1622 /** |
|
1623 * \fn PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val) |
|
1624 * \brief Swap bigendian signed 64 to platform's native byte order. |
|
1625 * |
|
1626 * Take a 64-bit signed value in bigendian format and convert it to |
|
1627 * the platform's native byte order. |
|
1628 * |
|
1629 * \param val value to convert |
|
1630 * \return converted value. |
|
1631 * |
|
1632 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
1633 * any sort of 64-bit support. |
|
1634 */ |
|
1635 PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val); |
|
1636 |
|
1637 |
|
1638 /** |
|
1639 * \fn PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val) |
|
1640 * \brief Swap bigendian unsigned 64 to platform's native byte order. |
|
1641 * |
|
1642 * Take a 64-bit unsigned value in bigendian format and convert it to |
|
1643 * the platform's native byte order. |
|
1644 * |
|
1645 * \param val value to convert |
|
1646 * \return converted value. |
|
1647 * |
|
1648 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
1649 * any sort of 64-bit support. |
|
1650 */ |
|
1651 PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val); |
|
1652 |
|
1653 #endif /* SWIG */ |
|
1654 |
|
1655 |
|
1656 /** |
|
1657 * \fn int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val) |
|
1658 * \brief Read and convert a signed 16-bit littleendian value. |
|
1659 * |
|
1660 * Convenience function. Read a signed 16-bit littleendian value from a |
|
1661 * file and convert it to the platform's native byte order. |
|
1662 * |
|
1663 * \param file PhysicsFS file handle from which to read. |
|
1664 * \param val pointer to where value should be stored. |
|
1665 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1666 * store the result. On failure, you can find out what went wrong |
|
1667 * from PHYSFS_getLastError(). |
|
1668 */ |
|
1669 PHYSFS_DECL int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val); |
|
1670 |
|
1671 |
|
1672 /** |
|
1673 * \fn int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val) |
|
1674 * \brief Read and convert an unsigned 16-bit littleendian value. |
|
1675 * |
|
1676 * Convenience function. Read an unsigned 16-bit littleendian value from a |
|
1677 * file and convert it to the platform's native byte order. |
|
1678 * |
|
1679 * \param file PhysicsFS file handle from which to read. |
|
1680 * \param val pointer to where value should be stored. |
|
1681 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1682 * store the result. On failure, you can find out what went wrong |
|
1683 * from PHYSFS_getLastError(). |
|
1684 * |
|
1685 */ |
|
1686 PHYSFS_DECL int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val); |
|
1687 |
|
1688 |
|
1689 /** |
|
1690 * \fn int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val) |
|
1691 * \brief Read and convert a signed 16-bit bigendian value. |
|
1692 * |
|
1693 * Convenience function. Read a signed 16-bit bigendian value from a |
|
1694 * file and convert it to the platform's native byte order. |
|
1695 * |
|
1696 * \param file PhysicsFS file handle from which to read. |
|
1697 * \param val pointer to where value should be stored. |
|
1698 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1699 * store the result. On failure, you can find out what went wrong |
|
1700 * from PHYSFS_getLastError(). |
|
1701 */ |
|
1702 PHYSFS_DECL int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val); |
|
1703 |
|
1704 |
|
1705 /** |
|
1706 * \fn int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val) |
|
1707 * \brief Read and convert an unsigned 16-bit bigendian value. |
|
1708 * |
|
1709 * Convenience function. Read an unsigned 16-bit bigendian value from a |
|
1710 * file and convert it to the platform's native byte order. |
|
1711 * |
|
1712 * \param file PhysicsFS file handle from which to read. |
|
1713 * \param val pointer to where value should be stored. |
|
1714 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1715 * store the result. On failure, you can find out what went wrong |
|
1716 * from PHYSFS_getLastError(). |
|
1717 * |
|
1718 */ |
|
1719 PHYSFS_DECL int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val); |
|
1720 |
|
1721 |
|
1722 /** |
|
1723 * \fn int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val) |
|
1724 * \brief Read and convert a signed 32-bit littleendian value. |
|
1725 * |
|
1726 * Convenience function. Read a signed 32-bit littleendian value from a |
|
1727 * file and convert it to the platform's native byte order. |
|
1728 * |
|
1729 * \param file PhysicsFS file handle from which to read. |
|
1730 * \param val pointer to where value should be stored. |
|
1731 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1732 * store the result. On failure, you can find out what went wrong |
|
1733 * from PHYSFS_getLastError(). |
|
1734 */ |
|
1735 PHYSFS_DECL int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val); |
|
1736 |
|
1737 |
|
1738 /** |
|
1739 * \fn int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val) |
|
1740 * \brief Read and convert an unsigned 32-bit littleendian value. |
|
1741 * |
|
1742 * Convenience function. Read an unsigned 32-bit littleendian value from a |
|
1743 * file and convert it to the platform's native byte order. |
|
1744 * |
|
1745 * \param file PhysicsFS file handle from which to read. |
|
1746 * \param val pointer to where value should be stored. |
|
1747 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1748 * store the result. On failure, you can find out what went wrong |
|
1749 * from PHYSFS_getLastError(). |
|
1750 * |
|
1751 */ |
|
1752 PHYSFS_DECL int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val); |
|
1753 |
|
1754 |
|
1755 /** |
|
1756 * \fn int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val) |
|
1757 * \brief Read and convert a signed 32-bit bigendian value. |
|
1758 * |
|
1759 * Convenience function. Read a signed 32-bit bigendian value from a |
|
1760 * file and convert it to the platform's native byte order. |
|
1761 * |
|
1762 * \param file PhysicsFS file handle from which to read. |
|
1763 * \param val pointer to where value should be stored. |
|
1764 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1765 * store the result. On failure, you can find out what went wrong |
|
1766 * from PHYSFS_getLastError(). |
|
1767 */ |
|
1768 PHYSFS_DECL int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val); |
|
1769 |
|
1770 |
|
1771 /** |
|
1772 * \fn int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val) |
|
1773 * \brief Read and convert an unsigned 32-bit bigendian value. |
|
1774 * |
|
1775 * Convenience function. Read an unsigned 32-bit bigendian value from a |
|
1776 * file and convert it to the platform's native byte order. |
|
1777 * |
|
1778 * \param file PhysicsFS file handle from which to read. |
|
1779 * \param val pointer to where value should be stored. |
|
1780 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1781 * store the result. On failure, you can find out what went wrong |
|
1782 * from PHYSFS_getLastError(). |
|
1783 * |
|
1784 */ |
|
1785 PHYSFS_DECL int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val); |
|
1786 |
|
1787 |
|
1788 /** |
|
1789 * \fn int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val) |
|
1790 * \brief Read and convert a signed 64-bit littleendian value. |
|
1791 * |
|
1792 * Convenience function. Read a signed 64-bit littleendian value from a |
|
1793 * file and convert it to the platform's native byte order. |
|
1794 * |
|
1795 * \param file PhysicsFS file handle from which to read. |
|
1796 * \param val pointer to where value should be stored. |
|
1797 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1798 * store the result. On failure, you can find out what went wrong |
|
1799 * from PHYSFS_getLastError(). |
|
1800 * |
|
1801 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without |
|
1802 * any sort of 64-bit support. |
|
1803 */ |
|
1804 PHYSFS_DECL int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val); |
|
1805 |
|
1806 |
|
1807 /** |
|
1808 * \fn int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val) |
|
1809 * \brief Read and convert an unsigned 64-bit littleendian value. |
|
1810 * |
|
1811 * Convenience function. Read an unsigned 64-bit littleendian value from a |
|
1812 * file and convert it to the platform's native byte order. |
|
1813 * |
|
1814 * \param file PhysicsFS file handle from which to read. |
|
1815 * \param val pointer to where value should be stored. |
|
1816 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1817 * store the result. On failure, you can find out what went wrong |
|
1818 * from PHYSFS_getLastError(). |
|
1819 * |
|
1820 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
1821 * any sort of 64-bit support. |
|
1822 */ |
|
1823 PHYSFS_DECL int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val); |
|
1824 |
|
1825 |
|
1826 /** |
|
1827 * \fn int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val) |
|
1828 * \brief Read and convert a signed 64-bit bigendian value. |
|
1829 * |
|
1830 * Convenience function. Read a signed 64-bit bigendian value from a |
|
1831 * file and convert it to the platform's native byte order. |
|
1832 * |
|
1833 * \param file PhysicsFS file handle from which to read. |
|
1834 * \param val pointer to where value should be stored. |
|
1835 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1836 * store the result. On failure, you can find out what went wrong |
|
1837 * from PHYSFS_getLastError(). |
|
1838 * |
|
1839 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without |
|
1840 * any sort of 64-bit support. |
|
1841 */ |
|
1842 PHYSFS_DECL int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val); |
|
1843 |
|
1844 |
|
1845 /** |
|
1846 * \fn int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val) |
|
1847 * \brief Read and convert an unsigned 64-bit bigendian value. |
|
1848 * |
|
1849 * Convenience function. Read an unsigned 64-bit bigendian value from a |
|
1850 * file and convert it to the platform's native byte order. |
|
1851 * |
|
1852 * \param file PhysicsFS file handle from which to read. |
|
1853 * \param val pointer to where value should be stored. |
|
1854 * \return zero on failure, non-zero on success. If successful, (*val) will |
|
1855 * store the result. On failure, you can find out what went wrong |
|
1856 * from PHYSFS_getLastError(). |
|
1857 * |
|
1858 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
1859 * any sort of 64-bit support. |
|
1860 */ |
|
1861 PHYSFS_DECL int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val); |
|
1862 |
|
1863 |
|
1864 /** |
|
1865 * \fn int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val) |
|
1866 * \brief Convert and write a signed 16-bit littleendian value. |
|
1867 * |
|
1868 * Convenience function. Convert a signed 16-bit value from the platform's |
|
1869 * native byte order to littleendian and write it to a file. |
|
1870 * |
|
1871 * \param file PhysicsFS file handle to which to write. |
|
1872 * \param val Value to convert and write. |
|
1873 * \return zero on failure, non-zero on success. On failure, you can |
|
1874 * find out what went wrong from PHYSFS_getLastError(). |
|
1875 */ |
|
1876 PHYSFS_DECL int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val); |
|
1877 |
|
1878 |
|
1879 /** |
|
1880 * \fn int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val) |
|
1881 * \brief Convert and write an unsigned 16-bit littleendian value. |
|
1882 * |
|
1883 * Convenience function. Convert an unsigned 16-bit value from the platform's |
|
1884 * native byte order to littleendian and write it to a file. |
|
1885 * |
|
1886 * \param file PhysicsFS file handle to which to write. |
|
1887 * \param val Value to convert and write. |
|
1888 * \return zero on failure, non-zero on success. On failure, you can |
|
1889 * find out what went wrong from PHYSFS_getLastError(). |
|
1890 */ |
|
1891 PHYSFS_DECL int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val); |
|
1892 |
|
1893 |
|
1894 /** |
|
1895 * \fn int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val) |
|
1896 * \brief Convert and write a signed 16-bit bigendian value. |
|
1897 * |
|
1898 * Convenience function. Convert a signed 16-bit value from the platform's |
|
1899 * native byte order to bigendian and write it to a file. |
|
1900 * |
|
1901 * \param file PhysicsFS file handle to which to write. |
|
1902 * \param val Value to convert and write. |
|
1903 * \return zero on failure, non-zero on success. On failure, you can |
|
1904 * find out what went wrong from PHYSFS_getLastError(). |
|
1905 */ |
|
1906 PHYSFS_DECL int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val); |
|
1907 |
|
1908 |
|
1909 /** |
|
1910 * \fn int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val) |
|
1911 * \brief Convert and write an unsigned 16-bit bigendian value. |
|
1912 * |
|
1913 * Convenience function. Convert an unsigned 16-bit value from the platform's |
|
1914 * native byte order to bigendian and write it to a file. |
|
1915 * |
|
1916 * \param file PhysicsFS file handle to which to write. |
|
1917 * \param val Value to convert and write. |
|
1918 * \return zero on failure, non-zero on success. On failure, you can |
|
1919 * find out what went wrong from PHYSFS_getLastError(). |
|
1920 */ |
|
1921 PHYSFS_DECL int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val); |
|
1922 |
|
1923 |
|
1924 /** |
|
1925 * \fn int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val) |
|
1926 * \brief Convert and write a signed 32-bit littleendian value. |
|
1927 * |
|
1928 * Convenience function. Convert a signed 32-bit value from the platform's |
|
1929 * native byte order to littleendian and write it to a file. |
|
1930 * |
|
1931 * \param file PhysicsFS file handle to which to write. |
|
1932 * \param val Value to convert and write. |
|
1933 * \return zero on failure, non-zero on success. On failure, you can |
|
1934 * find out what went wrong from PHYSFS_getLastError(). |
|
1935 */ |
|
1936 PHYSFS_DECL int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val); |
|
1937 |
|
1938 |
|
1939 /** |
|
1940 * \fn int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val) |
|
1941 * \brief Convert and write an unsigned 32-bit littleendian value. |
|
1942 * |
|
1943 * Convenience function. Convert an unsigned 32-bit value from the platform's |
|
1944 * native byte order to littleendian and write it to a file. |
|
1945 * |
|
1946 * \param file PhysicsFS file handle to which to write. |
|
1947 * \param val Value to convert and write. |
|
1948 * \return zero on failure, non-zero on success. On failure, you can |
|
1949 * find out what went wrong from PHYSFS_getLastError(). |
|
1950 */ |
|
1951 PHYSFS_DECL int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val); |
|
1952 |
|
1953 |
|
1954 /** |
|
1955 * \fn int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val) |
|
1956 * \brief Convert and write a signed 32-bit bigendian value. |
|
1957 * |
|
1958 * Convenience function. Convert a signed 32-bit value from the platform's |
|
1959 * native byte order to bigendian and write it to a file. |
|
1960 * |
|
1961 * \param file PhysicsFS file handle to which to write. |
|
1962 * \param val Value to convert and write. |
|
1963 * \return zero on failure, non-zero on success. On failure, you can |
|
1964 * find out what went wrong from PHYSFS_getLastError(). |
|
1965 */ |
|
1966 PHYSFS_DECL int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val); |
|
1967 |
|
1968 |
|
1969 /** |
|
1970 * \fn int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val) |
|
1971 * \brief Convert and write an unsigned 32-bit bigendian value. |
|
1972 * |
|
1973 * Convenience function. Convert an unsigned 32-bit value from the platform's |
|
1974 * native byte order to bigendian and write it to a file. |
|
1975 * |
|
1976 * \param file PhysicsFS file handle to which to write. |
|
1977 * \param val Value to convert and write. |
|
1978 * \return zero on failure, non-zero on success. On failure, you can |
|
1979 * find out what went wrong from PHYSFS_getLastError(). |
|
1980 */ |
|
1981 PHYSFS_DECL int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val); |
|
1982 |
|
1983 |
|
1984 /** |
|
1985 * \fn int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val) |
|
1986 * \brief Convert and write a signed 64-bit littleendian value. |
|
1987 * |
|
1988 * Convenience function. Convert a signed 64-bit value from the platform's |
|
1989 * native byte order to littleendian and write it to a file. |
|
1990 * |
|
1991 * \param file PhysicsFS file handle to which to write. |
|
1992 * \param val Value to convert and write. |
|
1993 * \return zero on failure, non-zero on success. On failure, you can |
|
1994 * find out what went wrong from PHYSFS_getLastError(). |
|
1995 * |
|
1996 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
1997 * any sort of 64-bit support. |
|
1998 */ |
|
1999 PHYSFS_DECL int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val); |
|
2000 |
|
2001 |
|
2002 /** |
|
2003 * \fn int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val) |
|
2004 * \brief Convert and write an unsigned 64-bit littleendian value. |
|
2005 * |
|
2006 * Convenience function. Convert an unsigned 64-bit value from the platform's |
|
2007 * native byte order to littleendian and write it to a file. |
|
2008 * |
|
2009 * \param file PhysicsFS file handle to which to write. |
|
2010 * \param val Value to convert and write. |
|
2011 * \return zero on failure, non-zero on success. On failure, you can |
|
2012 * find out what went wrong from PHYSFS_getLastError(). |
|
2013 * |
|
2014 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
2015 * any sort of 64-bit support. |
|
2016 */ |
|
2017 PHYSFS_DECL int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val); |
|
2018 |
|
2019 |
|
2020 /** |
|
2021 * \fn int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val) |
|
2022 * \brief Convert and write a signed 64-bit bigending value. |
|
2023 * |
|
2024 * Convenience function. Convert a signed 64-bit value from the platform's |
|
2025 * native byte order to bigendian and write it to a file. |
|
2026 * |
|
2027 * \param file PhysicsFS file handle to which to write. |
|
2028 * \param val Value to convert and write. |
|
2029 * \return zero on failure, non-zero on success. On failure, you can |
|
2030 * find out what went wrong from PHYSFS_getLastError(). |
|
2031 * |
|
2032 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
2033 * any sort of 64-bit support. |
|
2034 */ |
|
2035 PHYSFS_DECL int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val); |
|
2036 |
|
2037 |
|
2038 /** |
|
2039 * \fn int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val) |
|
2040 * \brief Convert and write an unsigned 64-bit bigendian value. |
|
2041 * |
|
2042 * Convenience function. Convert an unsigned 64-bit value from the platform's |
|
2043 * native byte order to bigendian and write it to a file. |
|
2044 * |
|
2045 * \param file PhysicsFS file handle to which to write. |
|
2046 * \param val Value to convert and write. |
|
2047 * \return zero on failure, non-zero on success. On failure, you can |
|
2048 * find out what went wrong from PHYSFS_getLastError(). |
|
2049 * |
|
2050 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without |
|
2051 * any sort of 64-bit support. |
|
2052 */ |
|
2053 PHYSFS_DECL int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val); |
|
2054 |
|
2055 |
|
2056 /* Everything above this line is part of the PhysicsFS 1.0 API. */ |
|
2057 |
|
2058 /** |
|
2059 * \fn int PHYSFS_isInit(void) |
|
2060 * \brief Determine if the PhysicsFS library is initialized. |
|
2061 * |
|
2062 * Once PHYSFS_init() returns successfully, this will return non-zero. |
|
2063 * Before a successful PHYSFS_init() and after PHYSFS_deinit() returns |
|
2064 * successfully, this will return zero. This function is safe to call at |
|
2065 * any time. |
|
2066 * |
|
2067 * \return non-zero if library is initialized, zero if library is not. |
|
2068 * |
|
2069 * \sa PHYSFS_init |
|
2070 * \sa PHYSFS_deinit |
|
2071 */ |
|
2072 PHYSFS_DECL int PHYSFS_isInit(void); |
|
2073 |
|
2074 |
|
2075 /** |
|
2076 * \fn int PHYSFS_symbolicLinksPermitted(void) |
|
2077 * \brief Determine if the symbolic links are permitted. |
|
2078 * |
|
2079 * This reports the setting from the last call to PHYSFS_permitSymbolicLinks(). |
|
2080 * If PHYSFS_permitSymbolicLinks() hasn't been called since the library was |
|
2081 * last initialized, symbolic links are implicitly disabled. |
|
2082 * |
|
2083 * \return non-zero if symlinks are permitted, zero if not. |
|
2084 * |
|
2085 * \sa PHYSFS_permitSymbolicLinks |
|
2086 */ |
|
2087 PHYSFS_DECL int PHYSFS_symbolicLinksPermitted(void); |
|
2088 |
|
2089 |
|
2090 #ifndef SWIG /* not available from scripting languages. */ |
|
2091 |
|
2092 /** |
|
2093 * \struct PHYSFS_Allocator |
|
2094 * \brief PhysicsFS allocation function pointers. |
|
2095 * |
|
2096 * (This is for limited, hardcore use. If you don't immediately see a need |
|
2097 * for it, you can probably ignore this forever.) |
|
2098 * |
|
2099 * You create one of these structures for use with PHYSFS_setAllocator. |
|
2100 * Allocators are assumed to be reentrant by the caller; please mutex |
|
2101 * accordingly. |
|
2102 * |
|
2103 * Allocations are always discussed in 64-bits, for future expansion...we're |
|
2104 * on the cusp of a 64-bit transition, and we'll probably be allocating 6 |
|
2105 * gigabytes like it's nothing sooner or later, and I don't want to change |
|
2106 * this again at that point. If you're on a 32-bit platform and have to |
|
2107 * downcast, it's okay to return NULL if the allocation is greater than |
|
2108 * 4 gigabytes, since you'd have to do so anyhow. |
|
2109 * |
|
2110 * \sa PHYSFS_setAllocator |
|
2111 */ |
|
2112 typedef struct PHYSFS_Allocator |
|
2113 { |
|
2114 int (*Init)(void); /**< Initialize. Can be NULL. Zero on failure. */ |
|
2115 void (*Deinit)(void); /**< Deinitialize your allocator. Can be NULL. */ |
|
2116 void *(*Malloc)(PHYSFS_uint64); /**< Allocate like malloc(). */ |
|
2117 void *(*Realloc)(void *, PHYSFS_uint64); /**< Reallocate like realloc(). */ |
|
2118 void (*Free)(void *); /**< Free memory from Malloc or Realloc. */ |
|
2119 } PHYSFS_Allocator; |
|
2120 |
|
2121 |
|
2122 /** |
|
2123 * \fn int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator) |
|
2124 * \brief Hook your own allocation routines into PhysicsFS. |
|
2125 * |
|
2126 * (This is for limited, hardcore use. If you don't immediately see a need |
|
2127 * for it, you can probably ignore this forever.) |
|
2128 * |
|
2129 * By default, PhysicsFS will use whatever is reasonable for a platform |
|
2130 * to manage dynamic memory (usually ANSI C malloc/realloc/free, but |
|
2131 * some platforms might use something else), but in some uncommon cases, the |
|
2132 * app might want more control over the library's memory management. This |
|
2133 * lets you redirect PhysicsFS to use your own allocation routines instead. |
|
2134 * You can only call this function before PHYSFS_init(); if the library is |
|
2135 * initialized, it'll reject your efforts to change the allocator mid-stream. |
|
2136 * You may call this function after PHYSFS_deinit() if you are willing to |
|
2137 * shut down the library and restart it with a new allocator; this is a safe |
|
2138 * and supported operation. The allocator remains intact between deinit/init |
|
2139 * calls. If you want to return to the platform's default allocator, pass a |
|
2140 * NULL in here. |
|
2141 * |
|
2142 * If you aren't immediately sure what to do with this function, you can |
|
2143 * safely ignore it altogether. |
|
2144 * |
|
2145 * \param allocator Structure containing your allocator's entry points. |
|
2146 * \return zero on failure, non-zero on success. This call only fails |
|
2147 * when used between PHYSFS_init() and PHYSFS_deinit() calls. |
|
2148 */ |
|
2149 PHYSFS_DECL int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator); |
|
2150 |
|
2151 #endif /* SWIG */ |
|
2152 |
|
2153 |
|
2154 /** |
|
2155 * \fn int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath) |
|
2156 * \brief Add an archive or directory to the search path. |
|
2157 * |
|
2158 * If this is a duplicate, the entry is not added again, even though the |
|
2159 * function succeeds. You may not add the same archive to two different |
|
2160 * mountpoints: duplicate checking is done against the archive and not the |
|
2161 * mountpoint. |
|
2162 * |
|
2163 * When you mount an archive, it is added to a virtual file system...all files |
|
2164 * in all of the archives are interpolated into a single hierachical file |
|
2165 * tree. Two archives mounted at the same place (or an archive with files |
|
2166 * overlapping another mountpoint) may have overlapping files: in such a case, |
|
2167 * the file earliest in the search path is selected, and the other files are |
|
2168 * inaccessible to the application. This allows archives to be used to |
|
2169 * override previous revisions; you can use the mounting mechanism to place |
|
2170 * archives at a specific point in the file tree and prevent overlap; this |
|
2171 * is useful for downloadable mods that might trample over application data |
|
2172 * or each other, for example. |
|
2173 * |
|
2174 * The mountpoint does not need to exist prior to mounting, which is different |
|
2175 * than those familiar with the Unix concept of "mounting" may not expect. |
|
2176 * As well, more than one archive can be mounted to the same mountpoint, or |
|
2177 * mountpoints and archive contents can overlap...the interpolation mechanism |
|
2178 * still functions as usual. |
|
2179 * |
|
2180 * \param newDir directory or archive to add to the path, in |
|
2181 * platform-dependent notation. |
|
2182 * \param mountPoint Location in the interpolated tree that this archive |
|
2183 * will be "mounted", in platform-independent notation. |
|
2184 * NULL or "" is equivalent to "/". |
|
2185 * \param appendToPath nonzero to append to search path, zero to prepend. |
|
2186 * \return nonzero if added to path, zero on failure (bogus archive, dir |
|
2187 * missing, etc). Specifics of the error can be |
|
2188 * gleaned from PHYSFS_getLastError(). |
|
2189 * |
|
2190 * \sa PHYSFS_removeFromSearchPath |
|
2191 * \sa PHYSFS_getSearchPath |
|
2192 * \sa PHYSFS_getMountPoint |
|
2193 * \sa PHYSFS_mountIo |
|
2194 */ |
|
2195 PHYSFS_DECL int PHYSFS_mount(const char *newDir, |
|
2196 const char *mountPoint, |
|
2197 int appendToPath); |
|
2198 |
|
2199 /** |
|
2200 * \fn int PHYSFS_getMountPoint(const char *dir) |
|
2201 * \brief Determine a mounted archive's mountpoint. |
|
2202 * |
|
2203 * You give this function the name of an archive or dir you successfully |
|
2204 * added to the search path, and it reports the location in the interpolated |
|
2205 * tree where it is mounted. Files mounted with a NULL mountpoint or through |
|
2206 * PHYSFS_addToSearchPath() will report "/". The return value is READ ONLY |
|
2207 * and valid until the archive is removed from the search path. |
|
2208 * |
|
2209 * \param dir directory or archive previously added to the path, in |
|
2210 * platform-dependent notation. This must match the string |
|
2211 * used when adding, even if your string would also reference |
|
2212 * the same file with a different string of characters. |
|
2213 * \return READ-ONLY string of mount point if added to path, NULL on failure |
|
2214 * (bogus archive, etc) Specifics of the error can be gleaned from |
|
2215 * PHYSFS_getLastError(). |
|
2216 * |
|
2217 * \sa PHYSFS_removeFromSearchPath |
|
2218 * \sa PHYSFS_getSearchPath |
|
2219 * \sa PHYSFS_getMountPoint |
|
2220 */ |
|
2221 PHYSFS_DECL const char *PHYSFS_getMountPoint(const char *dir); |
|
2222 |
|
2223 |
|
2224 #ifndef SWIG /* not available from scripting languages. */ |
|
2225 |
|
2226 /** |
|
2227 * \typedef PHYSFS_StringCallback |
|
2228 * \brief Function signature for callbacks that report strings. |
|
2229 * |
|
2230 * These are used to report a list of strings to an original caller, one |
|
2231 * string per callback. All strings are UTF-8 encoded. Functions should not |
|
2232 * try to modify or free the string's memory. |
|
2233 * |
|
2234 * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to |
|
2235 * functions that would return lists that need to be cleaned up with |
|
2236 * PHYSFS_freeList(). The callback means that the library doesn't need to |
|
2237 * allocate an entire list and all the strings up front. |
|
2238 * |
|
2239 * Be aware that promises data ordering in the list versions are not |
|
2240 * necessarily so in the callback versions. Check the documentation on |
|
2241 * specific APIs, but strings may not be sorted as you expect. |
|
2242 * |
|
2243 * \param data User-defined data pointer, passed through from the API |
|
2244 * that eventually called the callback. |
|
2245 * \param str The string data about which the callback is meant to inform. |
|
2246 * |
|
2247 * \sa PHYSFS_getCdRomDirsCallback |
|
2248 * \sa PHYSFS_getSearchPathCallback |
|
2249 */ |
|
2250 typedef void (*PHYSFS_StringCallback)(void *data, const char *str); |
|
2251 |
|
2252 |
|
2253 /** |
|
2254 * \typedef PHYSFS_EnumFilesCallback |
|
2255 * \brief Function signature for callbacks that enumerate files. |
|
2256 * |
|
2257 * These are used to report a list of directory entries to an original caller, |
|
2258 * one file/dir/symlink per callback. All strings are UTF-8 encoded. |
|
2259 * Functions should not try to modify or free any string's memory. |
|
2260 * |
|
2261 * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to |
|
2262 * functions that would return lists that need to be cleaned up with |
|
2263 * PHYSFS_freeList(). The callback means that the library doesn't need to |
|
2264 * allocate an entire list and all the strings up front. |
|
2265 * |
|
2266 * Be aware that promises data ordering in the list versions are not |
|
2267 * necessarily so in the callback versions. Check the documentation on |
|
2268 * specific APIs, but strings may not be sorted as you expect. |
|
2269 * |
|
2270 * \param data User-defined data pointer, passed through from the API |
|
2271 * that eventually called the callback. |
|
2272 * \param origdir A string containing the full path, in platform-independent |
|
2273 * notation, of the directory containing this file. In most |
|
2274 * cases, this is the directory on which you requested |
|
2275 * enumeration, passed in the callback for your convenience. |
|
2276 * \param fname The filename that is being enumerated. It may not be in |
|
2277 * alphabetical order compared to other callbacks that have |
|
2278 * fired, and it will not contain the full path. You can |
|
2279 * recreate the fullpath with $origdir/$fname ... The file |
|
2280 * can be a subdirectory, a file, a symlink, etc. |
|
2281 * |
|
2282 * \sa PHYSFS_enumerateFilesCallback |
|
2283 */ |
|
2284 typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir, |
|
2285 const char *fname); |
|
2286 |
|
2287 |
|
2288 /** |
|
2289 * \fn void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d) |
|
2290 * \brief Enumerate CD-ROM directories, using an application-defined callback. |
|
2291 * |
|
2292 * Internally, PHYSFS_getCdRomDirs() just calls this function and then builds |
|
2293 * a list before returning to the application, so functionality is identical |
|
2294 * except for how the information is represented to the application. |
|
2295 * |
|
2296 * Unlike PHYSFS_getCdRomDirs(), this function does not return an array. |
|
2297 * Rather, it calls a function specified by the application once per |
|
2298 * detected disc: |
|
2299 * |
|
2300 * \code |
|
2301 * |
|
2302 * static void foundDisc(void *data, const char *cddir) |
|
2303 * { |
|
2304 * printf("cdrom dir [%s] is available.\n", cddir); |
|
2305 * } |
|
2306 * |
|
2307 * // ... |
|
2308 * PHYSFS_getCdRomDirsCallback(foundDisc, NULL); |
|
2309 * \endcode |
|
2310 * |
|
2311 * This call may block while drives spin up. Be forewarned. |
|
2312 * |
|
2313 * \param c Callback function to notify about detected drives. |
|
2314 * \param d Application-defined data passed to callback. Can be NULL. |
|
2315 * |
|
2316 * \sa PHYSFS_StringCallback |
|
2317 * \sa PHYSFS_getCdRomDirs |
|
2318 */ |
|
2319 PHYSFS_DECL void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d); |
|
2320 |
|
2321 |
|
2322 /** |
|
2323 * \fn void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d) |
|
2324 * \brief Enumerate the search path, using an application-defined callback. |
|
2325 * |
|
2326 * Internally, PHYSFS_getSearchPath() just calls this function and then builds |
|
2327 * a list before returning to the application, so functionality is identical |
|
2328 * except for how the information is represented to the application. |
|
2329 * |
|
2330 * Unlike PHYSFS_getSearchPath(), this function does not return an array. |
|
2331 * Rather, it calls a function specified by the application once per |
|
2332 * element of the search path: |
|
2333 * |
|
2334 * \code |
|
2335 * |
|
2336 * static void printSearchPath(void *data, const char *pathItem) |
|
2337 * { |
|
2338 * printf("[%s] is in the search path.\n", pathItem); |
|
2339 * } |
|
2340 * |
|
2341 * // ... |
|
2342 * PHYSFS_getSearchPathCallback(printSearchPath, NULL); |
|
2343 * \endcode |
|
2344 * |
|
2345 * Elements of the search path are reported in order search priority, so the |
|
2346 * first archive/dir that would be examined when looking for a file is the |
|
2347 * first element passed through the callback. |
|
2348 * |
|
2349 * \param c Callback function to notify about search path elements. |
|
2350 * \param d Application-defined data passed to callback. Can be NULL. |
|
2351 * |
|
2352 * \sa PHYSFS_StringCallback |
|
2353 * \sa PHYSFS_getSearchPath |
|
2354 */ |
|
2355 PHYSFS_DECL void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d); |
|
2356 |
|
2357 |
|
2358 /** |
|
2359 * \fn void PHYSFS_enumerateFilesCallback(const char *dir, PHYSFS_EnumFilesCallback c, void *d) |
|
2360 * \brief Get a file listing of a search path's directory, using an application-defined callback. |
|
2361 * |
|
2362 * Internally, PHYSFS_enumerateFiles() just calls this function and then builds |
|
2363 * a list before returning to the application, so functionality is identical |
|
2364 * except for how the information is represented to the application. |
|
2365 * |
|
2366 * Unlike PHYSFS_enumerateFiles(), this function does not return an array. |
|
2367 * Rather, it calls a function specified by the application once per |
|
2368 * element of the search path: |
|
2369 * |
|
2370 * \code |
|
2371 * |
|
2372 * static void printDir(void *data, const char *origdir, const char *fname) |
|
2373 * { |
|
2374 * printf(" * We've got [%s] in [%s].\n", fname, origdir); |
|
2375 * } |
|
2376 * |
|
2377 * // ... |
|
2378 * PHYSFS_enumerateFilesCallback("/some/path", printDir, NULL); |
|
2379 * \endcode |
|
2380 * |
|
2381 * !!! FIXME: enumerateFiles() does not promise alphabetical sorting by |
|
2382 * !!! FIXME: case-sensitivity in the code, and doesn't promise sorting at |
|
2383 * !!! FIXME: all in the above docs. |
|
2384 * |
|
2385 * Items sent to the callback are not guaranteed to be in any order whatsoever. |
|
2386 * There is no sorting done at this level, and if you need that, you should |
|
2387 * probably use PHYSFS_enumerateFiles() instead, which guarantees |
|
2388 * alphabetical sorting. This form reports whatever is discovered in each |
|
2389 * archive before moving on to the next. Even within one archive, we can't |
|
2390 * guarantee what order it will discover data. <em>Any sorting you find in |
|
2391 * these callbacks is just pure luck. Do not rely on it.</em> As this walks |
|
2392 * the entire list of archives, you may receive duplicate filenames. |
|
2393 * |
|
2394 * \param dir Directory, in platform-independent notation, to enumerate. |
|
2395 * \param c Callback function to notify about search path elements. |
|
2396 * \param d Application-defined data passed to callback. Can be NULL. |
|
2397 * |
|
2398 * \sa PHYSFS_EnumFilesCallback |
|
2399 * \sa PHYSFS_enumerateFiles |
|
2400 */ |
|
2401 PHYSFS_DECL void PHYSFS_enumerateFilesCallback(const char *dir, |
|
2402 PHYSFS_EnumFilesCallback c, |
|
2403 void *d); |
|
2404 |
|
2405 /** |
|
2406 * \fn void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len) |
|
2407 * \brief Convert a UCS-4 string to a UTF-8 string. |
|
2408 * |
|
2409 * UCS-4 strings are 32-bits per character: \c wchar_t on Unix. |
|
2410 * |
|
2411 * To ensure that the destination buffer is large enough for the conversion, |
|
2412 * please allocate a buffer that is the same size as the source buffer. UTF-8 |
|
2413 * never uses more than 32-bits per character, so while it may shrink a UCS-4 |
|
2414 * string, it will never expand it. |
|
2415 * |
|
2416 * Strings that don't fit in the destination buffer will be truncated, but |
|
2417 * will always be null-terminated and never have an incomplete UTF-8 |
|
2418 * sequence at the end. If the buffer length is 0, this function does nothing. |
|
2419 * |
|
2420 * \param src Null-terminated source string in UCS-4 format. |
|
2421 * \param dst Buffer to store converted UTF-8 string. |
|
2422 * \param len Size, in bytes, of destination buffer. |
|
2423 */ |
|
2424 PHYSFS_DECL void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, |
|
2425 PHYSFS_uint64 len); |
|
2426 |
|
2427 /** |
|
2428 * \fn void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len) |
|
2429 * \brief Convert a UTF-8 string to a UCS-4 string. |
|
2430 * |
|
2431 * UCS-4 strings are 32-bits per character: \c wchar_t on Unix. |
|
2432 * |
|
2433 * To ensure that the destination buffer is large enough for the conversion, |
|
2434 * please allocate a buffer that is four times the size of the source buffer. |
|
2435 * UTF-8 uses from one to four bytes per character, but UCS-4 always uses |
|
2436 * four, so an entirely low-ASCII string will quadruple in size! |
|
2437 * |
|
2438 * Strings that don't fit in the destination buffer will be truncated, but |
|
2439 * will always be null-terminated and never have an incomplete UCS-4 |
|
2440 * sequence at the end. If the buffer length is 0, this function does nothing. |
|
2441 * |
|
2442 * \param src Null-terminated source string in UTF-8 format. |
|
2443 * \param dst Buffer to store converted UCS-4 string. |
|
2444 * \param len Size, in bytes, of destination buffer. |
|
2445 */ |
|
2446 PHYSFS_DECL void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, |
|
2447 PHYSFS_uint64 len); |
|
2448 |
|
2449 /** |
|
2450 * \fn void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) |
|
2451 * \brief Convert a UCS-2 string to a UTF-8 string. |
|
2452 * |
|
2453 * \warning you almost certainly should use PHYSFS_utf8FromUtf16(), which |
|
2454 * became available in PhysicsFS 2.1, unless you know what you're doing. |
|
2455 * |
|
2456 * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building |
|
2457 * with Unicode support. Please note that modern versions of Windows use |
|
2458 * UTF-16, which is an extended form of UCS-2, and not UCS-2 itself. You |
|
2459 * almost certainly want PHYSFS_utf8FromUtf16() instead. |
|
2460 * |
|
2461 * To ensure that the destination buffer is large enough for the conversion, |
|
2462 * please allocate a buffer that is double the size of the source buffer. |
|
2463 * UTF-8 never uses more than 32-bits per character, so while it may shrink |
|
2464 * a UCS-2 string, it may also expand it. |
|
2465 * |
|
2466 * Strings that don't fit in the destination buffer will be truncated, but |
|
2467 * will always be null-terminated and never have an incomplete UTF-8 |
|
2468 * sequence at the end. If the buffer length is 0, this function does nothing. |
|
2469 * |
|
2470 * \param src Null-terminated source string in UCS-2 format. |
|
2471 * \param dst Buffer to store converted UTF-8 string. |
|
2472 * \param len Size, in bytes, of destination buffer. |
|
2473 * |
|
2474 * \sa PHYSFS_utf8FromUtf16 |
|
2475 */ |
|
2476 PHYSFS_DECL void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, |
|
2477 PHYSFS_uint64 len); |
|
2478 |
|
2479 /** |
|
2480 * \fn PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) |
|
2481 * \brief Convert a UTF-8 string to a UCS-2 string. |
|
2482 * |
|
2483 * \warning you almost certainly should use PHYSFS_utf8ToUtf16(), which |
|
2484 * became available in PhysicsFS 2.1, unless you know what you're doing. |
|
2485 * |
|
2486 * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building |
|
2487 * with Unicode support. Please note that modern versions of Windows use |
|
2488 * UTF-16, which is an extended form of UCS-2, and not UCS-2 itself. You |
|
2489 * almost certainly want PHYSFS_utf8ToUtf16() instead, but you need to |
|
2490 * understand how that changes things, too. |
|
2491 * |
|
2492 * To ensure that the destination buffer is large enough for the conversion, |
|
2493 * please allocate a buffer that is double the size of the source buffer. |
|
2494 * UTF-8 uses from one to four bytes per character, but UCS-2 always uses |
|
2495 * two, so an entirely low-ASCII string will double in size! |
|
2496 * |
|
2497 * Strings that don't fit in the destination buffer will be truncated, but |
|
2498 * will always be null-terminated and never have an incomplete UCS-2 |
|
2499 * sequence at the end. If the buffer length is 0, this function does nothing. |
|
2500 * |
|
2501 * \param src Null-terminated source string in UTF-8 format. |
|
2502 * \param dst Buffer to store converted UCS-2 string. |
|
2503 * \param len Size, in bytes, of destination buffer. |
|
2504 * |
|
2505 * \sa PHYSFS_utf8ToUtf16 |
|
2506 */ |
|
2507 PHYSFS_DECL void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, |
|
2508 PHYSFS_uint64 len); |
|
2509 |
|
2510 /** |
|
2511 * \fn void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len) |
|
2512 * \brief Convert a UTF-8 string to a Latin1 string. |
|
2513 * |
|
2514 * Latin1 strings are 8-bits per character: a popular "high ASCII" encoding. |
|
2515 * |
|
2516 * To ensure that the destination buffer is large enough for the conversion, |
|
2517 * please allocate a buffer that is double the size of the source buffer. |
|
2518 * UTF-8 expands latin1 codepoints over 127 from 1 to 2 bytes, so the string |
|
2519 * may grow in some cases. |
|
2520 * |
|
2521 * Strings that don't fit in the destination buffer will be truncated, but |
|
2522 * will always be null-terminated and never have an incomplete UTF-8 |
|
2523 * sequence at the end. If the buffer length is 0, this function does nothing. |
|
2524 * |
|
2525 * Please note that we do not supply a UTF-8 to Latin1 converter, since Latin1 |
|
2526 * can't express most Unicode codepoints. It's a legacy encoding; you should |
|
2527 * be converting away from it at all times. |
|
2528 * |
|
2529 * \param src Null-terminated source string in Latin1 format. |
|
2530 * \param dst Buffer to store converted UTF-8 string. |
|
2531 * \param len Size, in bytes, of destination buffer. |
|
2532 */ |
|
2533 PHYSFS_DECL void PHYSFS_utf8FromLatin1(const char *src, char *dst, |
|
2534 PHYSFS_uint64 len); |
|
2535 |
|
2536 /* Everything above this line is part of the PhysicsFS 2.0 API. */ |
|
2537 |
|
2538 /** |
|
2539 * \fn int PHYSFS_unmount(const char *oldDir) |
|
2540 * \brief Remove a directory or archive from the search path. |
|
2541 * |
|
2542 * This is functionally equivalent to PHYSFS_removeFromSearchPath(), but that |
|
2543 * function is deprecated to keep the vocabulary paired with PHYSFS_mount(). |
|
2544 * |
|
2545 * This must be a (case-sensitive) match to a dir or archive already in the |
|
2546 * search path, specified in platform-dependent notation. |
|
2547 * |
|
2548 * This call will fail (and fail to remove from the path) if the element still |
|
2549 * has files open in it. |
|
2550 * |
|
2551 * \param oldDir dir/archive to remove. |
|
2552 * \return nonzero on success, zero on failure. |
|
2553 * Specifics of the error can be gleaned from PHYSFS_getLastError(). |
|
2554 * |
|
2555 * \sa PHYSFS_getSearchPath |
|
2556 * \sa PHYSFS_mount |
|
2557 */ |
|
2558 PHYSFS_DECL int PHYSFS_unmount(const char *oldDir); |
|
2559 |
|
2560 /** |
|
2561 * \fn const PHYSFS_Allocator *PHYSFS_getAllocator(void) |
|
2562 * \brief Discover the current allocator. |
|
2563 * |
|
2564 * (This is for limited, hardcore use. If you don't immediately see a need |
|
2565 * for it, you can probably ignore this forever.) |
|
2566 * |
|
2567 * This function exposes the function pointers that make up the currently used |
|
2568 * allocator. This can be useful for apps that want to access PhysicsFS's |
|
2569 * internal, default allocation routines, as well as for external code that |
|
2570 * wants to share the same allocator, even if the application specified their |
|
2571 * own. |
|
2572 * |
|
2573 * This call is only valid between PHYSFS_init() and PHYSFS_deinit() calls; |
|
2574 * it will return NULL if the library isn't initialized. As we can't |
|
2575 * guarantee the state of the internal allocators unless the library is |
|
2576 * initialized, you shouldn't use any allocator returned here after a call |
|
2577 * to PHYSFS_deinit(). |
|
2578 * |
|
2579 * Do not call the returned allocator's Init() or Deinit() methods under any |
|
2580 * circumstances. |
|
2581 * |
|
2582 * If you aren't immediately sure what to do with this function, you can |
|
2583 * safely ignore it altogether. |
|
2584 * |
|
2585 * \return Current allocator, as set by PHYSFS_setAllocator(), or PhysicsFS's |
|
2586 * internal, default allocator if no application defined allocator |
|
2587 * is currently set. Will return NULL if the library is not |
|
2588 * initialized. |
|
2589 * |
|
2590 * \sa PHYSFS_Allocator |
|
2591 * \sa PHYSFS_setAllocator |
|
2592 */ |
|
2593 PHYSFS_DECL const PHYSFS_Allocator *PHYSFS_getAllocator(void); |
|
2594 |
|
2595 #endif /* SWIG */ |
|
2596 |
|
2597 /** |
|
2598 * \enum PHYSFS_FileType |
|
2599 * \brief Type of a File |
|
2600 * |
|
2601 * Possible types of a file. |
|
2602 * |
|
2603 * \sa PHYSFS_stat |
|
2604 */ |
|
2605 typedef enum PHYSFS_FileType |
|
2606 { |
|
2607 PHYSFS_FILETYPE_REGULAR, /**< a normal file */ |
|
2608 PHYSFS_FILETYPE_DIRECTORY, /**< a directory */ |
|
2609 PHYSFS_FILETYPE_SYMLINK, /**< a symlink */ |
|
2610 PHYSFS_FILETYPE_OTHER /**< something completely different like a device */ |
|
2611 } PHYSFS_FileType; |
|
2612 |
|
2613 /** |
|
2614 * \struct PHYSFS_Stat |
|
2615 * \brief Meta data for a file or directory |
|
2616 * |
|
2617 * Container for various meta data about a file in the virtual file system. |
|
2618 * PHYSFS_stat() uses this structure for returning the information. The time |
|
2619 * data will be either the number of seconds since the Unix epoch (midnight, |
|
2620 * Jan 1, 1970), or -1 if the information isn't available or applicable. |
|
2621 * The (filesize) field is measured in bytes. |
|
2622 * The (readonly) field tells you whether when you open a file for writing you |
|
2623 * are writing to the same file as if you were opening it, given you have |
|
2624 * enough filesystem rights to do that. !!! FIXME: this might change. |
|
2625 * |
|
2626 * \sa PHYSFS_stat |
|
2627 * \sa PHYSFS_FileType |
|
2628 */ |
|
2629 typedef struct PHYSFS_Stat |
|
2630 { |
|
2631 PHYSFS_sint64 filesize; /**< size in bytes, -1 for non-files and unknown */ |
|
2632 PHYSFS_sint64 modtime; /**< last modification time */ |
|
2633 PHYSFS_sint64 createtime; /**< like modtime, but for file creation time */ |
|
2634 PHYSFS_sint64 accesstime; /**< like modtime, but for file access time */ |
|
2635 PHYSFS_FileType filetype; /**< File? Directory? Symlink? */ |
|
2636 int readonly; /**< non-zero if read only, zero if writable. */ |
|
2637 } PHYSFS_Stat; |
|
2638 |
|
2639 /** |
|
2640 * \fn int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat) |
|
2641 * \brief Get various information about a directory or a file. |
|
2642 * |
|
2643 * Obtain various information about a file or directory from the meta data. |
|
2644 * |
|
2645 * This function will never follow symbolic links. If you haven't enabled |
|
2646 * symlinks with PHYSFS_permitSymbolicLinks(), stat'ing a symlink will be |
|
2647 * treated like stat'ing a non-existant file. If symlinks are enabled, |
|
2648 * stat'ing a symlink will give you information on the link itself and not |
|
2649 * what it points to. |
|
2650 * |
|
2651 * \param fname filename to check, in platform-indepedent notation. |
|
2652 * \param stat pointer to structure to fill in with data about (fname). |
|
2653 * \return non-zero on success, zero on failure. On failure, (stat)'s |
|
2654 * contents are undefined. |
|
2655 * |
|
2656 * \sa PHYSFS_Stat |
|
2657 */ |
|
2658 PHYSFS_DECL int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat); |
|
2659 |
|
2660 |
|
2661 #ifndef SWIG /* not available from scripting languages. */ |
|
2662 |
|
2663 /** |
|
2664 * \fn void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) |
|
2665 * \brief Convert a UTF-16 string to a UTF-8 string. |
|
2666 * |
|
2667 * UTF-16 strings are 16-bits per character (except some chars, which are |
|
2668 * 32-bits): \c TCHAR on Windows, when building with Unicode support. Modern |
|
2669 * Windows releases use UTF-16. Windows releases before 2000 used TCHAR, but |
|
2670 * only handled UCS-2. UTF-16 _is_ UCS-2, except for the characters that |
|
2671 * are 4 bytes, which aren't representable in UCS-2 at all anyhow. If you |
|
2672 * aren't sure, you should be using UTF-16 at this point on Windows. |
|
2673 * |
|
2674 * To ensure that the destination buffer is large enough for the conversion, |
|
2675 * please allocate a buffer that is double the size of the source buffer. |
|
2676 * UTF-8 never uses more than 32-bits per character, so while it may shrink |
|
2677 * a UTF-16 string, it may also expand it. |
|
2678 * |
|
2679 * Strings that don't fit in the destination buffer will be truncated, but |
|
2680 * will always be null-terminated and never have an incomplete UTF-8 |
|
2681 * sequence at the end. If the buffer length is 0, this function does nothing. |
|
2682 * |
|
2683 * \param src Null-terminated source string in UTF-16 format. |
|
2684 * \param dst Buffer to store converted UTF-8 string. |
|
2685 * \param len Size, in bytes, of destination buffer. |
|
2686 */ |
|
2687 PHYSFS_DECL void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst, |
|
2688 PHYSFS_uint64 len); |
|
2689 |
|
2690 /** |
|
2691 * \fn PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) |
|
2692 * \brief Convert a UTF-8 string to a UTF-16 string. |
|
2693 * |
|
2694 * UTF-16 strings are 16-bits per character (except some chars, which are |
|
2695 * 32-bits): \c TCHAR on Windows, when building with Unicode support. Modern |
|
2696 * Windows releases use UTF-16. Windows releases before 2000 used TCHAR, but |
|
2697 * only handled UCS-2. UTF-16 _is_ UCS-2, except for the characters that |
|
2698 * are 4 bytes, which aren't representable in UCS-2 at all anyhow. If you |
|
2699 * aren't sure, you should be using UTF-16 at this point on Windows. |
|
2700 * |
|
2701 * To ensure that the destination buffer is large enough for the conversion, |
|
2702 * please allocate a buffer that is double the size of the source buffer. |
|
2703 * UTF-8 uses from one to four bytes per character, but UTF-16 always uses |
|
2704 * two to four, so an entirely low-ASCII string will double in size! The |
|
2705 * UTF-16 characters that would take four bytes also take four bytes in UTF-8, |
|
2706 * so you don't need to allocate 4x the space just in case: double will do. |
|
2707 * |
|
2708 * Strings that don't fit in the destination buffer will be truncated, but |
|
2709 * will always be null-terminated and never have an incomplete UTF-16 |
|
2710 * surrogate pair at the end. If the buffer length is 0, this function does |
|
2711 * nothing. |
|
2712 * |
|
2713 * \param src Null-terminated source string in UTF-8 format. |
|
2714 * \param dst Buffer to store converted UTF-16 string. |
|
2715 * \param len Size, in bytes, of destination buffer. |
|
2716 * |
|
2717 * \sa PHYSFS_utf8ToUtf16 |
|
2718 */ |
|
2719 PHYSFS_DECL void PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst, |
|
2720 PHYSFS_uint64 len); |
|
2721 |
|
2722 #endif /* SWIG */ |
|
2723 |
|
2724 |
|
2725 /** |
|
2726 * \fn PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer, PHYSFS_uint64 len) |
|
2727 * \brief Read bytes from a PhysicsFS filehandle |
|
2728 * |
|
2729 * The file must be opened for reading. |
|
2730 * |
|
2731 * \param handle handle returned from PHYSFS_openRead(). |
|
2732 * \param buffer buffer of at least (len) bytes to store read data into. |
|
2733 * \param len number of bytes being read from (handle). |
|
2734 * \return number of bytes read. This may be less than (len); this does not |
|
2735 * signify an error, necessarily (a short read may mean EOF). |
|
2736 * PHYSFS_getLastError() can shed light on the reason this might |
|
2737 * be < (len), as can PHYSFS_eof(). -1 if complete failure. |
|
2738 * |
|
2739 * \sa PHYSFS_eof |
|
2740 */ |
|
2741 PHYSFS_DECL PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer, |
|
2742 PHYSFS_uint64 len); |
|
2743 |
|
2744 /** |
|
2745 * \fn PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle, const void *buffer, PHYSFS_uint64 len) |
|
2746 * \brief Write data to a PhysicsFS filehandle |
|
2747 * |
|
2748 * The file must be opened for writing. |
|
2749 * |
|
2750 * Please note that while (len) is an unsigned 64-bit integer, you are limited |
|
2751 * to 63 bits (9223372036854775807 bytes), so we can return a negative value |
|
2752 * on error. If length is greater than 0x7FFFFFFFFFFFFFFF, this function will |
|
2753 * immediately fail. For systems without a 64-bit datatype, you are limited |
|
2754 * to 31 bits (0x7FFFFFFF, or 2147483647 bytes). We trust most things won't |
|
2755 * need to do multiple gigabytes of i/o in one call anyhow, but why limit |
|
2756 * things? |
|
2757 * |
|
2758 * \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend(). |
|
2759 * \param buffer buffer of (len) bytes to write to (handle). |
|
2760 * \param len number of bytes being written to (handle). |
|
2761 * \return number of bytes written. This may be less than (len); in the case |
|
2762 * of an error, the system may try to write as many bytes as possible, |
|
2763 * so an incomplete write might occur. PHYSFS_getLastError() can shed |
|
2764 * light on the reason this might be < (len). -1 if complete failure. |
|
2765 */ |
|
2766 PHYSFS_DECL PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle, |
|
2767 const void *buffer, |
|
2768 PHYSFS_uint64 len); |
|
2769 |
|
2770 |
|
2771 #ifndef SWIG /* not available from scripting languages. */ |
|
2772 |
|
2773 /** |
|
2774 * \struct PHYSFS_Io |
|
2775 * \brief An abstract i/o interface. |
|
2776 * |
|
2777 * \warning This is advanced, hardcore stuff. You don't need this unless you |
|
2778 * really know what you're doing. Most apps will not need this. |
|
2779 * |
|
2780 * Historically, PhysicsFS provided access to the physical filesystem and |
|
2781 * archives within that filesystem. However, sometimes you need more power |
|
2782 * than this. Perhaps you need to provide an archive that is entirely |
|
2783 * contained in RAM, or you need to bridge some other file i/o API to |
|
2784 * PhysicsFS, or you need to translate the bits (perhaps you have a |
|
2785 * a standard .zip file that's encrypted, and you need to decrypt on the fly |
|
2786 * for the unsuspecting zip archiver). |
|
2787 * |
|
2788 * A PHYSFS_Io is the interface that Archivers use to get archive data. |
|
2789 * Historically, this has mapped to file i/o to the physical filesystem, but |
|
2790 * as of PhysicsFS 2.1, applications can provide their own i/o implementations |
|
2791 * at runtime. |
|
2792 * |
|
2793 * This interface isn't necessarily a good universal fit for i/o. There are a |
|
2794 * few requirements of note: |
|
2795 * |
|
2796 * - They only do blocking i/o (at least, for now). |
|
2797 * - They need to be able to duplicate. If you have a file handle from |
|
2798 * fopen(), you need to be able to create a unique clone of it (so we |
|
2799 * have two handles to the same file that can both seek/read/etc without |
|
2800 * stepping on each other). |
|
2801 * - They need to know the size of their entire data set. |
|
2802 * - They need to be able to seek and rewind on demand. |
|
2803 * |
|
2804 * ...in short, you're probably not going to write an HTTP implementation. |
|
2805 * |
|
2806 * Thread safety: TO BE DECIDED. !!! FIXME |
|
2807 * |
|
2808 * \sa PHYSFS_mountIo |
|
2809 */ |
|
2810 typedef struct PHYSFS_Io |
|
2811 { |
|
2812 /** |
|
2813 * \brief Binary compatibility information. |
|
2814 * |
|
2815 * This must be set to zero at this time. Future versions of this |
|
2816 * struct will increment this field, so we know what a given |
|
2817 * implementation supports. We'll presumably keep supporting older |
|
2818 * versions as we offer new features, though. |
|
2819 */ |
|
2820 PHYSFS_uint32 version; |
|
2821 |
|
2822 /** |
|
2823 * \brief Instance data for this struct. |
|
2824 * |
|
2825 * Each instance has a pointer associated with it that can be used to |
|
2826 * store anything it likes. This pointer is per-instance of the stream, |
|
2827 * so presumably it will change when calling duplicate(). This can be |
|
2828 * deallocated during the destroy() method. |
|
2829 */ |
|
2830 void *opaque; |
|
2831 |
|
2832 /** |
|
2833 * \brief Read more data. |
|
2834 * |
|
2835 * Read (len) bytes from the interface, at the current i/o position, and |
|
2836 * store them in (buffer). The current i/o position should move ahead |
|
2837 * by the number of bytes successfully read. |
|
2838 * |
|
2839 * You don't have to implement this; set it to NULL if not implemented. |
|
2840 * This will only be used if the file is opened for reading. If set to |
|
2841 * NULL, a default implementation that immediately reports failure will |
|
2842 * be used. |
|
2843 * |
|
2844 * \param io The i/o instance to read from. |
|
2845 * \param buf The buffer to store data into. It must be at least |
|
2846 * (len) bytes long and can't be NULL. |
|
2847 * \param len The number of bytes to read from the interface. |
|
2848 * \return number of bytes read from file, 0 on EOF, -1 if complete |
|
2849 * failure. |
|
2850 */ |
|
2851 PHYSFS_sint64 (*read)(struct PHYSFS_Io *io, void *buf, PHYSFS_uint64 len); |
|
2852 |
|
2853 /** |
|
2854 * \brief Write more data. |
|
2855 * |
|
2856 * Write (len) bytes from (buffer) to the interface at the current i/o |
|
2857 * position. The current i/o position should move ahead by the number of |
|
2858 * bytes successfully written. |
|
2859 * |
|
2860 * You don't have to implement this; set it to NULL if not implemented. |
|
2861 * This will only be used if the file is opened for writing. If set to |
|
2862 * NULL, a default implementation that immediately reports failure will |
|
2863 * be used. |
|
2864 * |
|
2865 * You are allowed to buffer; a write can succeed here and then later |
|
2866 * fail when flushing. Note that PHYSFS_setBuffer() may be operating a |
|
2867 * level above your i/o, so you should usually not implement your |
|
2868 * own buffering routines. |
|
2869 * |
|
2870 * \param io The i/o instance to write to. |
|
2871 * \param buffer The buffer to read data from. It must be at least |
|
2872 * (len) bytes long and can't be NULL. |
|
2873 * \param len The number of bytes to read from (buffer). |
|
2874 * \return number of bytes written to file, -1 if complete failure. |
|
2875 */ |
|
2876 PHYSFS_sint64 (*write)(struct PHYSFS_Io *io, const void *buffer, |
|
2877 PHYSFS_uint64 len); |
|
2878 |
|
2879 /** |
|
2880 * \brief Move i/o position to a given byte offset from start. |
|
2881 * |
|
2882 * This method moves the i/o position, so the next read/write will |
|
2883 * be of the byte at (offset) offset. Seeks past the end of file should |
|
2884 * be treated as an error condition. |
|
2885 * |
|
2886 * \param io The i/o instance to seek. |
|
2887 * \param offset The new byte offset for the i/o position. |
|
2888 * \return non-zero on success, zero on error. |
|
2889 */ |
|
2890 int (*seek)(struct PHYSFS_Io *io, PHYSFS_uint64 offset); |
|
2891 |
|
2892 /** |
|
2893 * \brief Report current i/o position. |
|
2894 * |
|
2895 * Return bytes offset, or -1 if you aren't able to determine. A failure |
|
2896 * will almost certainly be fatal to further use of this stream, so you |
|
2897 * may not leave this unimplemented. |
|
2898 * |
|
2899 * \param io The i/o instance to query. |
|
2900 * \return The current byte offset for the i/o position, -1 if unknown. |
|
2901 */ |
|
2902 PHYSFS_sint64 (*tell)(struct PHYSFS_Io *io); |
|
2903 |
|
2904 /** |
|
2905 * \brief Determine size of the i/o instance's dataset. |
|
2906 * |
|
2907 * Return number of bytes available in the file, or -1 if you |
|
2908 * aren't able to determine. A failure will almost certainly be fatal |
|
2909 * to further use of this stream, so you may not leave this unimplemented. |
|
2910 * |
|
2911 * \param io The i/o instance to query. |
|
2912 * \return Total size, in bytes, of the dataset. |
|
2913 */ |
|
2914 PHYSFS_sint64 (*length)(struct PHYSFS_Io *io); |
|
2915 |
|
2916 /** |
|
2917 * \brief Duplicate this i/o instance. |
|
2918 * |
|
2919 * // !!! FIXME: write me. |
|
2920 * |
|
2921 * \param io The i/o instance to duplicate. |
|
2922 * \return A new value for a stream's (opaque) field, or NULL on error. |
|
2923 */ |
|
2924 struct PHYSFS_Io *(*duplicate)(struct PHYSFS_Io *io); |
|
2925 |
|
2926 /** |
|
2927 * \brief Flush resources to media, or wherever. |
|
2928 * |
|
2929 * This is the chance to report failure for writes that had claimed |
|
2930 * success earlier, but still had a chance to actually fail. This method |
|
2931 * can be NULL if flushing isn't necessary. |
|
2932 * |
|
2933 * This function may be called before destroy(), as it can report failure |
|
2934 * and destroy() can not. It may be called at other times, too. |
|
2935 * |
|
2936 * \param io The i/o instance to flush. |
|
2937 * \return Zero on error, non-zero on success. |
|
2938 */ |
|
2939 int (*flush)(struct PHYSFS_Io *io); |
|
2940 |
|
2941 /** |
|
2942 * \brief Cleanup and deallocate i/o instance. |
|
2943 * |
|
2944 * Free associated resources, including (opaque) if applicable. |
|
2945 * |
|
2946 * This function must always succeed: as such, it returns void. The |
|
2947 * system may call your flush() method before this. You may report |
|
2948 * failure there if necessary. This method may still be called if |
|
2949 * flush() fails, in which case you'll have to abandon unflushed data |
|
2950 * and other failing conditions and clean up. |
|
2951 * |
|
2952 * Once this method is called for a given instance, the system will assume |
|
2953 * it is unsafe to touch that instance again and will discard any |
|
2954 * references to it. |
|
2955 * |
|
2956 * \param s The i/o instance to destroy. |
|
2957 */ |
|
2958 void (*destroy)(struct PHYSFS_Io *io); |
|
2959 } PHYSFS_Io; |
|
2960 |
|
2961 |
|
2962 /** |
|
2963 * \fn int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, const char *mountPoint, int appendToPath) |
|
2964 * \brief Add an archive, built on a PHYSFS_Io, to the search path. |
|
2965 * |
|
2966 * \warning Unless you have some special, low-level need, you should be using |
|
2967 * PHYSFS_mount() instead of this. |
|
2968 * |
|
2969 * This function operates just like PHYSFS_mount(), but takes a PHYSFS_Io |
|
2970 * instead of a pathname. Behind the scenes, PHYSFS_mount() calls this |
|
2971 * function with a physical-filesystem-based PHYSFS_Io. |
|
2972 * |
|
2973 * (filename) is only used here to optimize archiver selection (if you name it |
|
2974 * XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't |
|
2975 * need to refer to a real file at all, and can even be NULL. If the filename |
|
2976 * isn't helpful, the system will try every archiver until one works or none |
|
2977 * of them do. |
|
2978 * |
|
2979 * (io) must remain until the archive is unmounted. When the archive is |
|
2980 * unmounted, the system will call (io)->destroy(io), which will give you |
|
2981 * a chance to free your resources. |
|
2982 * |
|
2983 * If this function fails, (io)->destroy(io) is not called. |
|
2984 * |
|
2985 * \param io i/o instance for archive to add to the path. |
|
2986 * \param fname Filename that can represent this stream. Can be NULL. |
|
2987 * \param mountPoint Location in the interpolated tree that this archive |
|
2988 * will be "mounted", in platform-independent notation. |
|
2989 * NULL or "" is equivalent to "/". |
|
2990 * \param appendToPath nonzero to append to search path, zero to prepend. |
|
2991 * \return nonzero if added to path, zero on failure (bogus archive, stream |
|
2992 * i/o issue, etc). Specifics of the error can be |
|
2993 * gleaned from PHYSFS_getLastError(). |
|
2994 * |
|
2995 * \sa PHYSFS_unmount |
|
2996 * \sa PHYSFS_getSearchPath |
|
2997 * \sa PHYSFS_getMountPoint |
|
2998 */ |
|
2999 PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, |
|
3000 const char *mountPoint, int appendToPath); |
|
3001 |
|
3002 #endif /* SWIG */ |
|
3003 |
|
3004 /** |
|
3005 * \fn int PHYSFS_mountMemory(const void *ptr, PHYSFS_uint64 len, void (*del)(void *), const char *fname, const char *mountPoint, int appendToPath) |
|
3006 * \brief Add an archive, contained in a memory buffer, to the search path. |
|
3007 * |
|
3008 * \warning Unless you have some special, low-level need, you should be using |
|
3009 * PHYSFS_mount() instead of this. |
|
3010 * |
|
3011 * This function operates just like PHYSFS_mount(), but takes a memory buffer |
|
3012 * instead of a pathname. This buffer contains all the data of the archive, |
|
3013 * and is used instead of a real file in the physical filesystem. |
|
3014 * |
|
3015 * (filename) is only used here to optimize archiver selection (if you name it |
|
3016 * XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't |
|
3017 * need to refer to a real file at all, and can even be NULL. If the filename |
|
3018 * isn't helpful, the system will try every archiver until one works or none |
|
3019 * of them do. |
|
3020 * |
|
3021 * (ptr) must remain until the archive is unmounted. When the archive is |
|
3022 * unmounted, the system will call (del)(ptr), which will notify you that |
|
3023 * the system is done with the buffer, and give you a chance to free your |
|
3024 * resources. (del) can be NULL, in which case the system will make no |
|
3025 * attempt to free the buffer. |
|
3026 * |
|
3027 * If this function fails, (del) is not called. |
|
3028 * |
|
3029 * \param ptr Address of the memory buffer containing the archive data. |
|
3030 * \param len Size of memory buffer, in bytes. |
|
3031 * \param del A callback that triggers upon unmount. Can be NULL. |
|
3032 * \param fname Filename that can represent this stream. Can be NULL. |
|
3033 * \param mountPoint Location in the interpolated tree that this archive |
|
3034 * will be "mounted", in platform-independent notation. |
|
3035 * NULL or "" is equivalent to "/". |
|
3036 * \param appendToPath nonzero to append to search path, zero to prepend. |
|
3037 * \return nonzero if added to path, zero on failure (bogus archive, etc). |
|
3038 * Specifics of the error can be gleaned from |
|
3039 * PHYSFS_getLastError(). |
|
3040 * |
|
3041 * \sa PHYSFS_unmount |
|
3042 * \sa PHYSFS_getSearchPath |
|
3043 * \sa PHYSFS_getMountPoint |
|
3044 */ |
|
3045 PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, |
|
3046 void (*del)(void *), const char *fname, |
|
3047 const char *mountPoint, int appendToPath); |
|
3048 |
|
3049 |
|
3050 /** |
|
3051 * \fn int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname, const char *mountPoint, int appendToPath) |
|
3052 * \brief Add an archive, contained in a PHYSFS_File handle, to the search path. |
|
3053 * |
|
3054 * \warning Unless you have some special, low-level need, you should be using |
|
3055 * PHYSFS_mount() instead of this. |
|
3056 * |
|
3057 * \warning Archives-in-archives may be very slow! While a PHYSFS_File can |
|
3058 * seek even when the data is compressed, it may do so by rewinding |
|
3059 * to the start and decompressing everything before the seek point. |
|
3060 * Normal archive usage may do a lot of seeking behind the scenes. |
|
3061 * As such, you might find normal archive usage extremely painful |
|
3062 * if mounted this way. Plan accordingly: if you, say, have a |
|
3063 * self-extracting .zip file, and want to mount something in it, |
|
3064 * compress the contents of the inner archive and make sure the outer |
|
3065 * .zip file doesn't compress the inner archive too. |
|
3066 * |
|
3067 * This function operates just like PHYSFS_mount(), but takes a PHYSFS_File |
|
3068 * handle instead of a pathname. This handle contains all the data of the |
|
3069 * archive, and is used instead of a real file in the physical filesystem. |
|
3070 * The PHYSFS_File may be backed by a real file in the physical filesystem, |
|
3071 * but isn't necessarily. The most popular use for this is likely to mount |
|
3072 * archives stored inside other archives. |
|
3073 * |
|
3074 * (filename) is only used here to optimize archiver selection (if you name it |
|
3075 * XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't |
|
3076 * need to refer to a real file at all, and can even be NULL. If the filename |
|
3077 * isn't helpful, the system will try every archiver until one works or none |
|
3078 * of them do. |
|
3079 * |
|
3080 * (file) must remain until the archive is unmounted. When the archive is |
|
3081 * unmounted, the system will call PHYSFS_close(file). If you need this |
|
3082 * handle to survive, you will have to wrap this in a PHYSFS_Io and use |
|
3083 * PHYSFS_mountIo() instead. |
|
3084 * |
|
3085 * If this function fails, PHYSFS_close(file) is not called. |
|
3086 * |
|
3087 * \param file The PHYSFS_File handle containing archive data. |
|
3088 * \param fname Filename that can represent this stream. Can be NULL. |
|
3089 * \param mountPoint Location in the interpolated tree that this archive |
|
3090 * will be "mounted", in platform-independent notation. |
|
3091 * NULL or "" is equivalent to "/". |
|
3092 * \param appendToPath nonzero to append to search path, zero to prepend. |
|
3093 * \return nonzero if added to path, zero on failure (bogus archive, etc). |
|
3094 * Specifics of the error can be gleaned from |
|
3095 * PHYSFS_getLastError(). |
|
3096 * |
|
3097 * \sa PHYSFS_unmount |
|
3098 * \sa PHYSFS_getSearchPath |
|
3099 * \sa PHYSFS_getMountPoint |
|
3100 */ |
|
3101 PHYSFS_DECL int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname, |
|
3102 const char *mountPoint, int appendToPath); |
|
3103 |
|
3104 |
|
3105 /** |
|
3106 * \enum PHYSFS_ErrorCode |
|
3107 * \brief Values that represent specific causes of failure. |
|
3108 * |
|
3109 * Most of the time, you should only concern yourself with whether a given |
|
3110 * operation failed or not, but there may be occasions where you plan to |
|
3111 * handle a specific failure case gracefully, so we provide specific error |
|
3112 * codes. |
|
3113 * |
|
3114 * Most of these errors are a little vague, and most aren't things you can |
|
3115 * fix...if there's a permission error, for example, all you can really do |
|
3116 * is pass that information on to the user and let them figure out how to |
|
3117 * handle it. In most these cases, your program should only care that it |
|
3118 * failed to accomplish its goals, and not care specifically why. |
|
3119 * |
|
3120 * \sa PHYSFS_getLastErrorCode |
|
3121 * \sa PHYSFS_getErrorByCode |
|
3122 */ |
|
3123 typedef enum PHYSFS_ErrorCode |
|
3124 { |
|
3125 PHYSFS_ERR_OK, /**< Success; no error. */ |
|
3126 PHYSFS_ERR_OTHER_ERROR, /**< Error not otherwise covered here. */ |
|
3127 PHYSFS_ERR_OUT_OF_MEMORY, /**< Memory allocation failed. */ |
|
3128 PHYSFS_ERR_NOT_INITIALIZED, /**< PhysicsFS is not initialized. */ |
|
3129 PHYSFS_ERR_IS_INITIALIZED, /**< PhysicsFS is already initialized. */ |
|
3130 PHYSFS_ERR_ARGV0_IS_NULL, /**< Needed argv[0], but it is NULL. */ |
|
3131 PHYSFS_ERR_UNSUPPORTED, /**< Operation or feature unsupported. */ |
|
3132 PHYSFS_ERR_PAST_EOF, /**< Attempted to access past end of file. */ |
|
3133 PHYSFS_ERR_FILES_STILL_OPEN, /**< Files still open. */ |
|
3134 PHYSFS_ERR_INVALID_ARGUMENT, /**< Bad parameter passed to an function. */ |
|
3135 PHYSFS_ERR_NOT_MOUNTED, /**< Requested archive/dir not mounted. */ |
|
3136 PHYSFS_ERR_NO_SUCH_PATH, /**< No such file, directory, or parent. */ |
|
3137 PHYSFS_ERR_SYMLINK_FORBIDDEN,/**< Symlink seen when not permitted. */ |
|
3138 PHYSFS_ERR_NO_WRITE_DIR, /**< No write dir has been specified. */ |
|
3139 PHYSFS_ERR_OPEN_FOR_READING, /**< Wrote to a file opened for reading. */ |
|
3140 PHYSFS_ERR_OPEN_FOR_WRITING, /**< Read from a file opened for writing. */ |
|
3141 PHYSFS_ERR_NOT_A_FILE, /**< Needed a file, got a directory (etc). */ |
|
3142 PHYSFS_ERR_READ_ONLY, /**< Wrote to a read-only filesystem. */ |
|
3143 PHYSFS_ERR_CORRUPT, /**< Corrupted data encountered. */ |
|
3144 PHYSFS_ERR_SYMLINK_LOOP, /**< Infinite symbolic link loop. */ |
|
3145 PHYSFS_ERR_IO, /**< i/o error (hardware failure, etc). */ |
|
3146 PHYSFS_ERR_PERMISSION, /**< Permission denied. */ |
|
3147 PHYSFS_ERR_NO_SPACE, /**< No space (disk full, over quota, etc) */ |
|
3148 PHYSFS_ERR_BAD_FILENAME, /**< Filename is bogus/insecure. */ |
|
3149 PHYSFS_ERR_BUSY, /**< Tried to modify a file the OS needs. */ |
|
3150 PHYSFS_ERR_DIR_NOT_EMPTY, /**< Tried to delete dir with files in it. */ |
|
3151 PHYSFS_ERR_OS_ERROR /**< Unspecified OS-level error. */ |
|
3152 } PHYSFS_ErrorCode; |
|
3153 |
|
3154 |
|
3155 /** |
|
3156 * \fn PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void) |
|
3157 * \brief Get machine-readable error information. |
|
3158 * |
|
3159 * Get the last PhysicsFS error message as an integer value. This will return |
|
3160 * PHYSFS_ERR_OK if there's been no error since the last call to this |
|
3161 * function. Each thread has a unique error state associated with it, but |
|
3162 * each time a new error message is set, it will overwrite the previous one |
|
3163 * associated with that thread. It is safe to call this function at anytime, |
|
3164 * even before PHYSFS_init(). |
|
3165 * |
|
3166 * PHYSFS_getLastError() and PHYSFS_getLastErrorCode() both reset the same |
|
3167 * thread-specific error state. Calling one will wipe out the other's |
|
3168 * data. If you need both, call PHYSFS_getLastErrorCode(), then pass that |
|
3169 * value to PHYSFS_getErrorByCode(). |
|
3170 * |
|
3171 * Generally, applications should only concern themselves with whether a |
|
3172 * given function failed; however, if you require more specifics, you can |
|
3173 * try this function to glean information, if there's some specific problem |
|
3174 * you're expecting and plan to handle. But with most things that involve |
|
3175 * file systems, the best course of action is usually to give up, report the |
|
3176 * problem to the user, and let them figure out what should be done about it. |
|
3177 * For that, you might prefer PHYSFS_getLastError() instead. |
|
3178 * |
|
3179 * \return Enumeration value that represents last reported error. |
|
3180 * |
|
3181 * \sa PHYSFS_getErrorByCode |
|
3182 */ |
|
3183 PHYSFS_DECL PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void); |
|
3184 |
|
3185 |
|
3186 /** |
|
3187 * \fn const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code) |
|
3188 * \brief Get human-readable description string for a given error code. |
|
3189 * |
|
3190 * Get a static string, in UTF-8 format, that represents an English |
|
3191 * description of a given error code. |
|
3192 * |
|
3193 * This string is guaranteed to never change (although we may add new strings |
|
3194 * for new error codes in later versions of PhysicsFS), so you can use it |
|
3195 * for keying a localization dictionary. |
|
3196 * |
|
3197 * It is safe to call this function at anytime, even before PHYSFS_init(). |
|
3198 * |
|
3199 * These strings are meant to be passed on directly to the user. |
|
3200 * Generally, applications should only concern themselves with whether a |
|
3201 * given function failed, but not care about the specifics much. |
|
3202 * |
|
3203 * Do not attempt to free the returned strings; they are read-only and you |
|
3204 * don't own their memory pages. |
|
3205 * |
|
3206 * \param code Error code to convert to a string. |
|
3207 * \return READ ONLY string of requested error message, NULL if this |
|
3208 * is not a valid PhysicsFS error code. Always check for NULL if |
|
3209 * you might be looking up an error code that didn't exist in an |
|
3210 * earlier version of PhysicsFS. |
|
3211 * |
|
3212 * \sa PHYSFS_getLastErrorCode |
|
3213 */ |
|
3214 PHYSFS_DECL const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code); |
|
3215 |
|
3216 /** |
|
3217 * \fn void PHYSFS_setErrorCode(PHYSFS_ErrorCode code) |
|
3218 * \brief Set the current thread's error code. |
|
3219 * |
|
3220 * This lets you set the value that will be returned by the next call to |
|
3221 * PHYSFS_getLastErrorCode(). This will replace any existing error code, |
|
3222 * whether set by your application or internally by PhysicsFS. |
|
3223 * |
|
3224 * Error codes are stored per-thread; what you set here will not be |
|
3225 * accessible to another thread. |
|
3226 * |
|
3227 * Any call into PhysicsFS may change the current error code, so any code you |
|
3228 * set here is somewhat fragile, and thus you shouldn't build any serious |
|
3229 * error reporting framework on this function. The primary goal of this |
|
3230 * function is to allow PHYSFS_Io implementations to set the error state, |
|
3231 * which generally will be passed back to your application when PhysicsFS |
|
3232 * makes a PHYSFS_Io call that fails internally. |
|
3233 * |
|
3234 * This function doesn't care if the error code is a value known to PhysicsFS |
|
3235 * or not (but PHYSFS_getErrorByCode() will return NULL for unknown values). |
|
3236 * The value will be reported unmolested by PHYSFS_getLastErrorCode(). |
|
3237 * |
|
3238 * \param code Error code to become the current thread's new error state. |
|
3239 * |
|
3240 * \sa PHYSFS_getLastErrorCode |
|
3241 * \sa PHYSFS_getErrorByCode |
|
3242 */ |
|
3243 PHYSFS_DECL void PHYSFS_setErrorCode(PHYSFS_ErrorCode code); |
|
3244 |
|
3245 |
|
3246 /** |
|
3247 * \fn const char *PHYSFS_getPrefDir(const char *org, const char *app) |
|
3248 * \brief Get the user-and-app-specific path where files can be written. |
|
3249 * |
|
3250 * Helper function. |
|
3251 * |
|
3252 * Get the "pref dir". This is meant to be where users can write personal |
|
3253 * files (preferences and save games, etc) that are specific to your |
|
3254 * application. This directory is unique per user, per application. |
|
3255 * |
|
3256 * This function will decide the appropriate location in the native filesystem, |
|
3257 * create the directory if necessary, and return a string in |
|
3258 * platform-dependent notation, suitable for passing to PHYSFS_setWriteDir(). |
|
3259 * |
|
3260 * On Windows, this might look like: |
|
3261 * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name" |
|
3262 * |
|
3263 * On Linux, this might look like: |
|
3264 * "/home/bob/.local/share/My Program Name" |
|
3265 * |
|
3266 * On Mac OS X, this might look like: |
|
3267 * "/Users/bob/Library/Application Support/My Program Name" |
|
3268 * |
|
3269 * (etc.) |
|
3270 * |
|
3271 * You should probably use the pref dir for your write dir, and also put it |
|
3272 * near the beginning of your search path. Older versions of PhysicsFS |
|
3273 * offered only PHYSFS_getUserDir() and left you to figure out where the |
|
3274 * files should go under that tree. This finds the correct location |
|
3275 * for whatever platform, which not only changes between operating systems, |
|
3276 * but also versions of the same operating system. |
|
3277 * |
|
3278 * You specify the name of your organization (if it's not a real organization, |
|
3279 * your name or an Internet domain you own might do) and the name of your |
|
3280 * application. These should be proper names. |
|
3281 * |
|
3282 * Both the (org) and (app) strings may become part of a directory name, so |
|
3283 * please follow these rules: |
|
3284 * |
|
3285 * - Try to use the same org string (including case-sensitivity) for |
|
3286 * all your applications that use this function. |
|
3287 * - Always use a unique app string for each one, and make sure it never |
|
3288 * changes for an app once you've decided on it. |
|
3289 * - Unicode characters are legal, as long as it's UTF-8 encoded, but... |
|
3290 * - ...only use letters, numbers, and spaces. Avoid punctuation like |
|
3291 * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. |
|
3292 * |
|
3293 * The pointer returned by this function remains valid until you call this |
|
3294 * function again, or call PHYSFS_deinit(). This is not necessarily a fast |
|
3295 * call, though, so you should call this once at startup and copy the string |
|
3296 * if you need it. |
|
3297 * |
|
3298 * You should assume the path returned by this function is the only safe |
|
3299 * place to write files (and that PHYSFS_getUserDir() and PHYSFS_getBaseDir(), |
|
3300 * while they might be writable, or even parents of the returned path, aren't |
|
3301 * where you should be writing things). |
|
3302 * |
|
3303 * \param org The name of your organization. |
|
3304 * \param app The name of your application. |
|
3305 * \return READ ONLY string of user dir in platform-dependent notation. NULL |
|
3306 * if there's a problem (creating directory failed, etc). |
|
3307 * |
|
3308 * \sa PHYSFS_getBaseDir |
|
3309 * \sa PHYSFS_getUserDir |
|
3310 */ |
|
3311 PHYSFS_DECL const char *PHYSFS_getPrefDir(const char *org, const char *app); |
|
3312 |
|
3313 |
|
3314 /* Everything above this line is part of the PhysicsFS 2.1 API. */ |
|
3315 |
|
3316 |
|
3317 #ifdef __cplusplus |
|
3318 } |
|
3319 #endif |
|
3320 |
|
3321 #endif /* !defined _INCLUDE_PHYSFS_H_ */ |
|
3322 |
|
3323 /* end of physfs.h ... */ |
|
3324 |