That works fine, as long as you stay on the same OS / platform. Later, you read it back in, and create a new FSNode from it. you can "serialize" an FSNode to a path, via the FSNode::getPath() method, then write that to a config file. Hence, the only valid way to do that is to feed a "path" created by another FSNode to this FSNode. Caveat: You may not assume anything about the path format, like what the separator char is in fact, there may not even exist the *concept* of a path separator on the target system. by asking a directory FSNode for a child nodeįinally, you can create FSNodes from "paths".by asking a node for the node of its parent dir.from a simple filename (assumes that the file resides in the current directory).The FSNode provides methods for checking this, though. This might be a file or a directory, or it might not exist at all. Example: A FSNode could refer to "/home/you/foo.txt" (for the Windows folks, "C:\Documents\foo.txt"). Think of it as a generalization of a path. Represents one specific file or directory in the filesystem (which may or may not exist). The Parts of the System FSNode (from common/fs.h) By providing Archive subclasses, you can extend this arbitrarily. In particular, the SearchMan is such an Archive subclass, and can wrap arbitrary paths, ZIP or ARJ archives, etc. a ZIPArchive) to it, and it will search for that file in the Archive). There are new File::open methods: You can pass an "Archive" subclass (e.g.See the doxygen docs of class FSDirectory for details. You can pass relative paths in a limited fashion you must use the "/" character as separator.You must not pass absolute paths to File::open()! If you must open a file using a path, the correct way is to first create an FSNode from the path, then pass that to File::open.See the doxygen documentation of that class to see how to access the contents of a file. on Mac OS X, the Resource directory of the.on some platforms, a global data dir (e.g., /usr/share/scummvm ).the game-specific "extrapath" from the config fileĪlso, by default it contains a number of system-specific paths, such as:.the global "extrapath" from the config file.This functions by searching through a default search path managed by the SearchManager (short: SearchMan). open ( "data/datafile.dat" )) // access f #include "common/file.h" Common :: File f if ( ! f.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |