/usr/share/doc/libphysfs1/html/index.html is in libphysfs-dev 2.0.3-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>physfs: PhysicsFS</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">physfs
 <span id="projectnumber">unknown version (build with 'make docs' next time!)</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li class="current"><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">PhysicsFS </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>The latest version of PhysicsFS can be found at: <a href="http://icculus.org/physfs/">http://icculus.org/physfs/</a></p>
<p>PhysicsFS; a portable, flexible file i/o abstraction.</p>
<p>This API gives you access to a system file system in ways superior to the stdio or system i/o calls. The brief benefits:</p>
<ul>
<li>It's portable.</li>
<li>It's safe. No file access is permitted outside the specified dirs.</li>
<li>It's flexible. Archives (.ZIP files) can be used transparently as directory structures.</li>
</ul>
<p>This system is largely inspired by Quake 3's PK3 files and the related fs_* cvars. If you've ever tinkered with these, then this API will be familiar to you.</p>
<p>With PhysicsFS, you have a single writing directory and multiple directories (the "search path") for reading. You can think of this as a filesystem within a filesystem. If (on Windows) you were to set the writing directory to "C:\MyGame\MyWritingDirectory", then no PHYSFS calls could touch anything above this directory, including the "C:\MyGame" and "C:\" directories. This prevents an application's internal scripting language from piddling over c:\config.sys, for example. If you'd rather give PHYSFS full access to the system's REAL file system, set the writing dir to "C:\", but that's generally A Bad Thing for several reasons.</p>
<p>Drive letters are hidden in PhysicsFS once you set up your initial paths. The search path creates a single, hierarchical directory structure. Not only does this lend itself well to general abstraction with archives, it also gives better support to operating systems like MacOS and Unix. Generally speaking, you shouldn't ever hardcode a drive letter; not only does this hurt portability to non-Microsoft OSes, but it limits your win32 users to a single drive, too. Use the PhysicsFS abstraction functions and allow user-defined configuration options, too. When opening a file, you specify it like it was on a Unix filesystem: if you want to write to "C:\MyGame\MyConfigFiles\game.cfg", then you might set the write dir to "C:\MyGame" and then open "MyConfigFiles/game.cfg". This gives an abstraction across all platforms. Specifying a file in this way is termed "platform-independent notation" in this documentation. Specifying a a filename in a form such as "C:\mydir\myfile" or "MacOS hard drive:My Directory:My File" is termed "platform-dependent
notation". The only time you use platform-dependent notation is when setting up your write directory and search path; after that, all file access into those directories are done with platform-independent notation.</p>
<p>All files opened for writing are opened in relation to the write directory, which is the root of the writable filesystem. When opening a file for reading, PhysicsFS goes through the search path. This is NOT the same thing as the PATH environment variable. An application using PhysicsFS specifies directories to be searched which may be actual directories, or archive files that contain files and subdirectories of their own. See the end of these docs for currently supported archive formats.</p>
<p>Once the search path is defined, you may open files for reading. If you've got the following search path defined (to use a win32 example again):</p>
<ul>
<li>C:\mygame</li>
<li>C:\mygame\myuserfiles</li>
<li>D:\mygamescdromdatafiles</li>
<li>C:\mygame\installeddatafiles.zip</li>
</ul>
<p>Then a call to PHYSFS_openRead("textfiles/myfile.txt") (note the directory separator, lack of drive letter, and lack of dir separator at the start of the string; this is platform-independent notation) will check for C:\mygame\textfiles\myfile.txt, then C:\mygame\myuserfiles\textfiles\myfile.txt, then D:\mygamescdromdatafiles\textfiles\myfile.txt, then, finally, for textfiles\myfile.txt inside of C:\mygame\installeddatafiles.zip. Remember that most archive types and platform filesystems store their filenames in a case-sensitive manner, so you should be careful to specify it correctly.</p>
<p>Files opened through PhysicsFS may NOT contain "." or ".." or ":" as dir elements. Not only are these meaningless on MacOS Classic and/or Unix, they are a security hole. Also, symbolic links (which can be found in some archive types and directly in the filesystem on Unix platforms) are NOT followed until you call <a class="el" href="physfs_8h.html#aad451d9b3f46f627a1be8caee2eef9b7" title="Enable or disable following of symbolic links. ">PHYSFS_permitSymbolicLinks()</a>. That's left to your own discretion, as following a symlink can allow for access outside the write dir and search paths. For portability, there is no mechanism for creating new symlinks in PhysicsFS.</p>
<p>The write dir is not included in the search path unless you specifically add it. While you CAN change the write dir as many times as you like, you should probably set it once and stick to it. Remember that your program will not have permission to write in every directory on Unix and NT systems.</p>
<p>All files are opened in binary mode; there is no endline conversion for textfiles. Other than that, PhysicsFS has some convenience functions for platform-independence. There is a function to tell you the current platform's dir separator ("\\" on windows, "/" on Unix, ":" on MacOS), which is needed only to set up your search/write paths. There is a function to tell you what CD-ROM drives contain accessible discs, and a function to recommend a good search path, etc.</p>
<p>A recommended order for the search path is the write dir, then the base dir, then the cdrom dir, then any archives discovered. Quake 3 does something like this, but moves the archives to the start of the search path. Build Engine games, like Duke Nukem 3D and Blood, place the archives last, and use the base dir for both searching and writing. There is a helper function (<a class="el" href="physfs_8h.html#afef8700f714b6800ff688372c540bfe2" title="Set up sane, default paths. ">PHYSFS_setSaneConfig()</a>) that puts together a basic configuration for you, based on a few parameters. Also see the comments on <a class="el" href="physfs_8h.html#a0034c327dfb381a1c95deb80878bcede" title="Get the path where the application resides. ">PHYSFS_getBaseDir()</a>, and <a class="el" href="physfs_8h.html#a9d86fca7a5cbbc53f5425ff7539b1426" title="Get the path where user's home directory resides. ">PHYSFS_getUserDir()</a> for info on what those are and how they can help you determine an optimal search path.</p>
<p>PhysicsFS 2.0 adds the concept of "mounting" archives to arbitrary points in the search path. If a zipfile contains "maps/level.map" and you mount that archive at "mods/mymod", then you would have to open "mods/mymod/maps/level.map" to access the file, even though "mods/mymod" isn't actually specified in the .zip file. Unlike the Unix mentality of mounting a filesystem, "mods/mymod" doesn't actually have to exist when mounting the zipfile. It's a "virtual" directory. The mounting mechanism allows the developer to seperate archives in the tree and avoid trampling over files when added new archives, such as including mod support in a game...keeping external content on a tight leash in this manner can be of utmost importance to some applications.</p>
<p>PhysicsFS is mostly thread safe. The error messages returned by PHYSFS_getLastError are unique by thread, and library-state-setting functions are mutex'd. For efficiency, individual file accesses are not locked, so you can not safely read/write/seek/close/etc the same file from two threads at the same time. Other race conditions are bugs that should be reported/patched.</p>
<p>While you CAN use stdio/syscall file access in a program that has PHYSFS_* calls, doing so is not recommended, and you can not use system filehandles with PhysicsFS and vice versa.</p>
<p>Note that archives need not be named as such: if you have a ZIP file and rename it with a .PKG extension, the file will still be recognized as a ZIP archive by PhysicsFS; the file's contents are used to determine its type where possible.</p>
<p>Currently supported archive types:</p><ul>
<li>.ZIP (pkZip/WinZip/Info-ZIP compatible)</li>
<li>.GRP (Build Engine groupfile archives)</li>
<li>.PAK (Quake I/II archive format)</li>
<li>.HOG (Descent I/II HOG file archives)</li>
<li>.MVL (Descent II movielib archives)</li>
<li>.WAD (DOOM engine archives)</li>
</ul>
<p>String policy for PhysicsFS 2.0 and later:</p>
<p>PhysicsFS 1.0 could only deal with null-terminated ASCII strings. All high ASCII chars resulted in undefined behaviour, and there was no Unicode support at all. PhysicsFS 2.0 supports Unicode without breaking binary compatibility with the 1.0 API by using UTF-8 encoding of all strings passed in and out of the library.</p>
<p>All strings passed through PhysicsFS are in null-terminated UTF-8 format. This means that if all you care about is English (ASCII characters <= 127) then you just use regular C strings. If you care about Unicode (and you should!) then you need to figure out what your platform wants, needs, and offers. If you are on Windows and build with Unicode support, your TCHAR strings are two bytes per character (this is called "UCS-2 encoding"). You should convert them to UTF-8 before handing them to PhysicsFS with <a class="el" href="physfs_8h.html#ac4fdac7e09fb03ccdccdeed997f09c1a" title="Convert a UCS-2 string to a UTF-8 string. ">PHYSFS_utf8FromUcs2()</a>. If you're using Unix or Mac OS X, your wchar_t strings are four bytes per character ("UCS-4 encoding"). Use <a class="el" href="physfs_8h.html#ac18c9c45db1be6fd26be19d0f4d25a60" title="Convert a UCS-4 string to a UTF-8 string. ">PHYSFS_utf8FromUcs4()</a>. Mac OS X can give you UTF-8 directly from a CFString, and many Unixes generally give you C strings in UTF-8 format everywhere. If you have a single-byte high ASCII charset, like so-many European "codepages" you may be out of luck. We'll convert from "Latin1" to UTF-8 only, and never back to Latin1. If you're above ASCII 127, all bets are off: move to Unicode or use your platform's facilities. Passing a C string with high-ASCII data that isn't UTF-8 encoded will NOT do what you expect!</p>
<p>Naturally, there's also <a class="el" href="physfs_8h.html#a0ab51c265f7ca4e8218d6c74b4f43401" title="Convert a UTF-8 string to a UCS-2 string. ">PHYSFS_utf8ToUcs2()</a> and <a class="el" href="physfs_8h.html#a3ff1045e71cd4c14607973da7bfc41e5" title="Convert a UTF-8 string to a UCS-4 string. ">PHYSFS_utf8ToUcs4()</a> to get data back into a format you like. Behind the scenes, PhysicsFS will use Unicode where possible: the UTF-8 strings on Windows will be converted and used with the multibyte Windows APIs, for example.</p>
<p>PhysicsFS offers basic encoding conversion support, but not a whole string library. Get your stuff into whatever format you can work with.</p>
<p>Some platforms and archivers don't offer full Unicode support behind the scenes. For example, OS/2 only offers "codepages" and the filesystem itself doesn't support multibyte encodings. We make an earnest effort to convert to/from the current locale here, but all bets are off if you want to hand an arbitrary Japanese character through to these systems. Modern OSes (Mac OS X, Linux, Windows, PocketPC, etc) should all be fine. Many game-specific archivers are seriously unprepared for Unicode (the Descent HOG/MVL and Build Engine GRP archivers, for example, only offer a DOS 8.3 filename, for example). Nothing can be done for these, but they tend to be legacy formats for existing content that was all ASCII (and thus, valid UTF-8) anyhow. Other formats, like .ZIP, don't explicitly offer Unicode support, but unofficially expect filenames to be UTF-8 encoded, and thus Just Work. Most everything does the right thing without bothering you, but it's good to be aware of these nuances in case they don't.</p>
<p>Other stuff:</p>
<p>Please see the file LICENSE.txt in the source's root directory for licensing and redistribution rights.</p>
<p>Please see the file CREDITS.txt in the source's root directory for a more or less complete list of who's responsible for this.</p>
<dl class="section author"><dt>Author</dt><dd>Ryan C. Gordon. </dd></dl>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
|