Panda3D
|
A hierarchy of directories and files that appears to be one continuous file system, even though the files may originate from several different sources that may not be related to the actual OS's file system. More...
#include "virtualFileSystem.h"
Public Types | |
enum | MountFlags { MF_read_only = 0x0002 } |
enum | OpenFlags { OF_status_only = 0x0001, OF_create_file = 0x0002, OF_make_directory = 0x0004, OF_allow_nonexist = 0x0008 } |
Public Member Functions | |
bool | atomic_compare_and_exchange_contents (const Filename &filename, string &orig_contents, const string &old_contents, const string &new_contents) |
See Filename::atomic_compare_and_exchange_contents(). More... | |
bool | atomic_read_contents (const Filename &filename, string &contents) const |
See Filename::atomic_read_contents(). More... | |
bool | chdir (const Filename &new_directory) |
Changes the current directory. More... | |
bool | copy_file (const Filename &orig_filename, const Filename &new_filename) |
Attempts to copy the contents of the indicated file to the indicated file. More... | |
PointerTo< VirtualFile > | create_file (const Filename &filename) |
Attempts to create a file by the indicated name in the filesystem, if possible, and returns it. More... | |
bool | delete_file (const Filename &filename) |
Attempts to delete the indicated file or directory. More... | |
bool | exists (const Filename &filename) const |
Convenience function; returns true if the named file exists. More... | |
int | find_all_files (const Filename &filename, const DSearchPath &searchpath, DSearchPath::Results &results) const |
Searches all the directories in the search list for the indicated file, in order. More... | |
PointerTo< VirtualFile > | find_file (const Filename &filename, const DSearchPath &searchpath, bool status_only=false) const |
Uses the indicated search path to find the file within the file system. More... | |
Filename | get_cwd () const |
Returns the current directory name. More... | |
PointerTo< VirtualFile > | get_file (const Filename &filename, bool status_only=false) const |
Looks up the file by the indicated name in the file system. More... | |
PointerTo< VirtualFileMount > | get_mount (int n) const |
Returns the nth mount in the system. More... | |
int | get_num_mounts () const |
Returns the number of individual mounts in the system. More... | |
bool | is_directory (const Filename &filename) const |
Convenience function; returns true if the named file exists and is a directory. More... | |
bool | is_regular_file (const Filename &filename) const |
Convenience function; returns true if the named file exists and is a regular file. More... | |
void | ls (const Filename &filename) const |
void | ls_all (const Filename &filename) const |
bool | make_directory (const Filename &filename) |
Attempts to create a directory within the file system. More... | |
bool | make_directory_full (const Filename &filename) |
Attempts to create a directory within the file system. More... | |
MAKE_SEQ (get_mounts, get_num_mounts, get_mount) | |
bool | mount (Multifile *multifile, const Filename &mount_point, int flags) |
Mounts the indicated Multifile at the given mount point. More... | |
bool | mount (const Filename &physical_filename, const Filename &mount_point, int flags, const string &password="") |
Mounts the indicated system file or directory at the given mount point. More... | |
bool | mount (VirtualFileMount *mount, const Filename &mount_point, int flags) |
Adds the given VirtualFileMount object to the mount list. More... | |
bool | mount_loop (const Filename &virtual_filename, const Filename &mount_point, int flags, const string &password="") |
This is similar to mount(), but it receives the name of a Multifile that already appears within the virtual file system. More... | |
ostream * | open_append_file (const Filename &filename) |
Works like open_write_file(), but the file is opened in append mode. More... | |
iostream * | open_read_append_file (const Filename &filename) |
Works like open_read_write_file(), but the file is opened in append mode. More... | |
istream * | open_read_file (const Filename &filename, bool auto_unwrap) const |
Convenience function; returns a newly allocated istream if the file exists and can be read, or NULL otherwise. More... | |
iostream * | open_read_write_file (const Filename &filename, bool truncate) |
Convenience function; returns a newly allocated iostream if the file exists and can be written, or NULL otherwise. More... | |
ostream * | open_write_file (const Filename &filename, bool auto_wrap, bool truncate) |
Convenience function; returns a newly allocated ostream if the file exists and can be written, or NULL otherwise. More... | |
string | read_file (const Filename &filename, bool auto_unwrap) const |
bool | read_file (const Filename &filename, string &result, bool auto_unwrap) const |
Convenience function; fills the string up with the data from the indicated file, if it exists and can be read. More... | |
bool | read_file (const Filename &filename, pvector< unsigned char > &result, bool auto_unwrap) const |
Convenience function; fills the pvector up with the data from the indicated file, if it exists and can be read. More... | |
bool | rename_file (const Filename &orig_filename, const Filename &new_filename) |
Attempts to move or rename the indicated file or directory. More... | |
bool | resolve_filename (Filename &filename, const DSearchPath &searchpath, const string &default_extension=string()) const |
Searches the given search path for the filename. More... | |
PointerTo< VirtualFileList > | scan_directory (const Filename &filename) const |
void | scan_mount_points (vector_string &names, const Filename &path) const |
Adds to names a list of all the mount points in use that are one directory below path, if any. More... | |
int | unmount (Multifile *multifile) |
Unmounts all appearances of the indicated Multifile from the file system. More... | |
int | unmount (const Filename &physical_filename) |
Unmounts all appearances of the indicated directory name or multifile name from the file system. More... | |
int | unmount (VirtualFileMount *mount) |
Unmounts the indicated VirtualFileMount object from the file system. More... | |
int | unmount_all () |
Unmounts all files from the file system. More... | |
int | unmount_point (const Filename &mount_point) |
Unmounts all systems attached to the given mount point from the file system. More... | |
void | write (ostream &out) const |
Print debugging information. More... | |
bool | write_file (const Filename &filename, const string &data, bool auto_wrap) |
bool | write_file (const Filename &filename, const unsigned char *data, size_t data_size, bool auto_wrap) |
Convenience function; writes the entire contents of the indicated file as a block of data. More... | |
Static Public Member Functions | |
static void | close_read_file (istream *stream) |
Closes a file opened by a previous call to open_read_file(). More... | |
static void | close_read_write_file (iostream *stream) |
Closes a file opened by a previous call to open_read_write_file(). More... | |
static void | close_write_file (ostream *stream) |
Closes a file opened by a previous call to open_write_file(). More... | |
static VirtualFileSystem * | get_global_ptr () |
Returns the default global VirtualFileSystem. More... | |
static void | parse_option (const string &option, int &flags, string &password) |
Parses one of the option flags in the options list on the vfs-mount Config.prc line. More... | |
static void | parse_options (const string &options, int &flags, string &password) |
Parses all of the option flags in the options list on the vfs-mount Config.prc line. More... | |
Public Attributes | |
ConfigVariableBool | vfs_case_sensitive |
ConfigVariableBool | vfs_implicit_mf |
ConfigVariableBool | vfs_implicit_pz |
A hierarchy of directories and files that appears to be one continuous file system, even though the files may originate from several different sources that may not be related to the actual OS's file system.
For instance, a VirtualFileSystem can transparently mount one or more Multifiles as their own subdirectory hierarchies.
Definition at line 44 of file virtualFileSystem.h.
bool VirtualFileSystem::atomic_compare_and_exchange_contents | ( | const Filename & | filename, |
string & | orig_contents, | ||
const string & | old_contents, | ||
const string & | new_contents | ||
) |
See Filename::atomic_compare_and_exchange_contents().
Definition at line 1116 of file virtualFileSystem.cxx.
References atomic_read_contents().
Referenced by close_read_write_file(), and BamCache::flush_index().
bool VirtualFileSystem::atomic_read_contents | ( | const Filename & | filename, |
string & | contents | ||
) | const |
See Filename::atomic_read_contents().
Definition at line 1133 of file virtualFileSystem.cxx.
References scan_mount_points().
Referenced by atomic_compare_and_exchange_contents(), and BamCache::list_index().
bool VirtualFileSystem::chdir | ( | const Filename & | new_directory | ) |
Changes the current directory.
This is used to resolve relative pathnames in get_file() and/or find_file(). Returns true if successful, false otherwise.
Definition at line 471 of file virtualFileSystem.cxx.
References get_cwd().
Referenced by get_mount().
|
static |
Closes a file opened by a previous call to open_read_file().
This really just deletes the istream pointer, but it is recommended to use this interface instead of deleting it explicitly, to help work around compiler issues.
Definition at line 962 of file virtualFileSystem.cxx.
References open_write_file().
Referenced by SpeedTreeNode::add_from_stf(), PandaIOSystem::Close(), DatagramInputFile::close(), FfmpegVirtualFile::close(), VirtualFileMount::close_read_file(), Texture::ensure_loader_type(), FmodAudioSound::get_finished_event(), TexturePool::get_global_ptr(), PNMImageHeader::make_reader(), open_read_file(), DXFFile::process(), XFile::read(), PfmFile::read(), DCFile::read(), FltHeader::read_flt(), RocketFileInterface::RocketFileInterface(), HashVal::set_from_bin(), IffInputFile::set_input(), x11GraphicsWindow::set_properties_now(), DownloadDb::set_server_multifile_hash(), and WavAudioCursor::~WavAudioCursor().
|
static |
Closes a file opened by a previous call to open_read_write_file().
This really just deletes the iostream pointer, but it is recommended to use this interface instead of deleting it explicitly, to help work around compiler issues.
Definition at line 1099 of file virtualFileSystem.cxx.
References atomic_compare_and_exchange_contents().
Referenced by VirtualFileMount::close_read_write_file(), and open_read_append_file().
|
static |
Closes a file opened by a previous call to open_write_file().
This really just deletes the ostream pointer, but it is recommended to use this interface instead of deleting it explicitly, to help work around compiler issues.
Definition at line 1035 of file virtualFileSystem.cxx.
References open_read_write_file().
Referenced by DatagramOutputFile::close(), VirtualFileMount::close_write_file(), Texture::ensure_loader_type(), open_append_file(), EggData::write_egg(), and EggToObjConverter::write_file().
Attempts to copy the contents of the indicated file to the indicated file.
Returns true on success, false on failure.
Definition at line 691 of file virtualFileSystem.cxx.
References resolve_filename().
Referenced by PathReplace::full_convert_path(), and rename_file().
PointerTo< VirtualFile > VirtualFileSystem::create_file | ( | const Filename & | filename | ) |
Attempts to create a file by the indicated name in the filesystem, if possible, and returns it.
If a file by this name already exists, returns the same thing as get_file(). If the filename is located within a read-only directory, or the directory doesn't exist, returns NULL.
Definition at line 586 of file virtualFileSystem.cxx.
References find_file().
Referenced by get_file(), DatagramOutputFile::open(), and write_file().
bool VirtualFileSystem::delete_file | ( | const Filename & | filename | ) |
Attempts to delete the indicated file or directory.
This can remove a single file or an empty directory. It will not remove a nonempty directory. Returns true on success, false on failure.
Definition at line 637 of file virtualFileSystem.cxx.
References rename_file().
Referenced by find_file(), BamCache::flush_index(), BamCache::list_index(), BamFile::open_write(), BamCache::store(), EggData::write_egg(), and EggToObjConverter::write_file().
|
inline |
Convenience function; returns true if the named file exists.
Definition at line 23 of file virtualFileSystem.I.
References get_file(), and is_directory().
Referenced by SpeedTreeNode::add_from_stf(), Texture::ensure_loader_type(), PandaIOSystem::Exists(), PathReplace::full_convert_path(), TexturePool::get_global_ptr(), WindowFramework::load_model(), Texture::load_related(), PathReplace::match_path(), EggData::resolve_egg_filename(), BamCache::store(), and ModelPool::write().
int VirtualFileSystem::find_all_files | ( | const Filename & | filename, |
const DSearchPath & | searchpath, | ||
DSearchPath::Results & | results | ||
) | const |
Searches all the directories in the search list for the indicated file, in order.
Fills up the results list with *all* of the matching filenames found, if any. Returns the number of matches found.
It is the responsibility of the the caller to clear the results list first; otherwise, the newly-found files will be appended to the list.
Definition at line 767 of file virtualFileSystem.cxx.
References DSearchPath::Results::add_file(), DSearchPath::get_directory(), DSearchPath::get_num_directories(), Filename::is_fully_qualified(), Filename::is_local(), and write().
Referenced by resolve_filename().
PointerTo< VirtualFile > VirtualFileSystem::find_file | ( | const Filename & | filename, |
const DSearchPath & | searchpath, | ||
bool | status_only = false |
||
) | const |
Uses the indicated search path to find the file within the file system.
Returns the first occurrence of the file found, or NULL if the file cannot be found.
Definition at line 602 of file virtualFileSystem.cxx.
References delete_file(), DSearchPath::get_directory(), DSearchPath::get_num_directories(), Filename::is_fully_qualified(), and Filename::is_local().
Referenced by Shader::compile_parameter(), and create_file().
Filename VirtualFileSystem::get_cwd | ( | ) | const |
Returns the current directory name.
See chdir().
Definition at line 496 of file virtualFileSystem.cxx.
References make_directory().
Referenced by chdir(), Texture::finalize(), BamCache::set_root(), and SpeedTreeNode::InstanceList::write_datagram().
PointerTo< VirtualFile > VirtualFileSystem::get_file | ( | const Filename & | filename, |
bool | status_only = false |
||
) | const |
Looks up the file by the indicated name in the file system.
Returns a VirtualFile pointer representing the file if it is found, or NULL if it is not.
If status_only is true, the file will be checked for existence and length and so on, but the returned file's contents cannot be read. This is an optimization which is especially important for certain mount types, for instance HTTP, for which opening a file to determine its status is substantially less expensive than opening it to read its contents.
Definition at line 567 of file virtualFileSystem.cxx.
References create_file().
Referenced by BamCacheRecord::add_dependent_file(), SpeedTreeNode::add_from_stf(), Shader::compile_parameter(), DatagramOutputFile::copy_datagram(), BamCacheRecord::dependents_unchanged(), Texture::ensure_loader_type(), exists(), FmodAudioSound::FmodAudioSound(), TexturePool::get_global_ptr(), is_directory(), is_regular_file(), make_directory_full(), DatagramInputFile::open(), Multifile::open_read(), FfmpegVirtualFile::open_vfs(), PfmFile::read(), EggData::read(), read_file(), RocketFileInterface::RocketFileInterface(), VirtualFile::scan_directory(), and ModelPool::write().
|
static |
Returns the default global VirtualFileSystem.
You may create your own personal VirtualFileSystem objects and use them for whatever you like, but Panda will attempt to load models and stuff from this default object.
Initially, the global VirtualFileSystem is set up to mount the OS filesystem to root; i.e. it is equivalent to the OS filesystem. This may be subsequently adjusted by the user.
Definition at line 828 of file virtualFileSystem.cxx.
References ExecutionEnvironment::expand_string(), Filename::from_os_specific(), ExecutionEnvironment::get_cwd(), ConfigVariableList::get_num_unique_values(), ConfigVariableList::get_unique_value(), mount(), and open_read_file().
Referenced by BamCacheRecord::add_dependent_file(), SpeedTreeNode::add_from_stf(), VirtualFileMountSystem::atomic_compare_and_exchange_contents(), VirtualFileMountSystem::atomic_read_contents(), AssimpLoader::build_graph(), DatagramInputFile::close(), DatagramOutputFile::close(), Shader::compile_parameter(), ObjToEggConverter::convert_file(), DatagramOutputFile::copy_datagram(), BamCacheRecord::dependents_unchanged(), Texture::ensure_loader_type(), Texture::finalize(), BamCache::flush_index(), FmodAudioSound::FmodAudioSound(), PathReplace::full_convert_path(), AudioManager::get_dls_pathname(), FmodAudioSound::get_finished_event(), TexturePool::get_global_ptr(), VirtualFileMountSystem::has_file(), VirtualFileMountSystem::is_directory(), VirtualFileMountSystem::is_regular_file(), OpenALAudioManager::is_valid(), FmodAudioManager::is_valid(), VirtualFileMountSystem::is_writable(), BamCache::list_index(), WindowFramework::load_model(), Texture::load_related(), PNMImageHeader::make_reader(), PNMImageHeader::make_writer(), PathReplace::match_path(), DatagramInputFile::open(), DatagramOutputFile::open(), VirtualFileMountSystem::open_append_file(), IffInputFile::open_read(), Multifile::open_read(), VirtualFileMountSystem::open_read_append_file(), VirtualFileMountSystem::open_read_file(), VirtualFileMountSystem::open_read_write_file(), FfmpegVirtualFile::open_vfs(), BamFile::open_write(), VirtualFileMountSystem::open_write_file(), DXFFile::process(), XFile::read(), PfmFile::read(), DCFile::read(), EggData::read(), ColladaLoader::read(), FltHeader::read_flt(), EggData::resolve_egg_filename(), EggGroupNode::resolve_filenames(), RocketFileInterface::RocketFileInterface(), VirtualFileMountSystem::scan_directory(), HashVal::set_from_bin(), IffInputFile::set_input(), x11GraphicsWindow::set_properties_now(), BamCache::set_root(), DownloadDb::set_server_multifile_hash(), STBasicTerrain::setup_terrain(), BamCache::store(), OpenALAudioManager::uncache_sound(), Multifile::update_subfile(), ShaderPool::write(), FontPool::write(), ModelPool::write(), write(), SpeedTreeNode::InstanceList::write_datagram(), EggData::write_egg(), EggToObjConverter::write_file(), WavAudio::~WavAudio(), and WavAudioCursor::~WavAudioCursor().
PointerTo< VirtualFileMount > VirtualFileSystem::get_mount | ( | int | n | ) | const |
Returns the nth mount in the system.
Definition at line 451 of file virtualFileSystem.cxx.
References chdir().
Referenced by get_num_mounts().
int VirtualFileSystem::get_num_mounts | ( | ) | const |
Returns the number of individual mounts in the system.
Definition at line 438 of file virtualFileSystem.cxx.
References get_mount().
Referenced by unmount_all().
|
inline |
Convenience function; returns true if the named file exists and is a directory.
Definition at line 34 of file virtualFileSystem.I.
References get_file(), and is_regular_file().
Referenced by exists(), and BamCache::set_root().
|
inline |
Convenience function; returns true if the named file exists and is a regular file.
Definition at line 46 of file virtualFileSystem.I.
References get_file(), and VirtualFile::scan_directory().
Referenced by AssimpLoader::build_graph(), and is_directory().
bool VirtualFileSystem::make_directory | ( | const Filename & | filename | ) |
Attempts to create a directory within the file system.
Returns true on success, false on failure (for instance, because the parent directory does not exist, or is read-only). If the directory already existed prior to this call, returns true.
Definition at line 513 of file virtualFileSystem.cxx.
References make_directory_full().
Referenced by get_cwd().
bool VirtualFileSystem::make_directory_full | ( | const Filename & | filename | ) |
Attempts to create a directory within the file system.
Will also create any intervening directories needed. Returns true on success, false on failure.
Definition at line 529 of file virtualFileSystem.cxx.
References get_file().
Referenced by PathReplace::full_convert_path(), make_directory(), and BamCache::set_root().
Mounts the indicated Multifile at the given mount point.
Definition at line 91 of file virtualFileSystem.cxx.
Referenced by get_global_ptr(), VirtualFileMount::get_mount_flags(), and mount_loop().
bool VirtualFileSystem::mount | ( | const Filename & | physical_filename, |
const Filename & | mount_point, | ||
int | flags, | ||
const string & | password = "" |
||
) |
Mounts the indicated system file or directory at the given mount point.
If the named file is a directory, mounts the directory. If the named file is a Multifile, mounts it as a Multifile. Returns true on success, false on failure.
A given system directory may be mounted to multiple different mount point, and the same mount point may share multiple system directories. In the case of ambiguities (that is, two different files with exactly the same full pathname), the most-recently mounted system wins.
The filename specified as the first parameter must refer to a real, physical filename on disk; it cannot be a virtual file already appearing within the vfs filespace. However, it is possible to mount such a file; see mount_loop() for this.
Definition at line 125 of file virtualFileSystem.cxx.
References Filename::exists(), Filename::is_directory(), mount_loop(), and Multifile::set_encryption_password().
bool VirtualFileSystem::mount | ( | VirtualFileMount * | mount, |
const Filename & | mount_point, | ||
int | flags | ||
) |
Adds the given VirtualFileMount object to the mount list.
This is a lower-level function that the other flavors of mount(); it requires you to create a VirtualFileMount object specifically.
Definition at line 211 of file virtualFileSystem.cxx.
References unmount().
bool VirtualFileSystem::mount_loop | ( | const Filename & | virtual_filename, |
const Filename & | mount_point, | ||
int | flags, | ||
const string & | password = "" |
||
) |
This is similar to mount(), but it receives the name of a Multifile that already appears within the virtual file system.
It can be used to mount a Multifile that is itself hosted within a virtually-mounted Multifile.
This interface can also be used to mount physical files (that appear within the virtual filespace), but it cannot be used to mount directories. Use mount() if you need to mount a directory.
Note that there is additional overhead, in the form of additional buffer copies of the data, for recursively mounting a multifile like this.
Definition at line 172 of file virtualFileSystem.cxx.
References mount(), and Multifile::set_encryption_password().
Referenced by mount().
ostream * VirtualFileSystem::open_append_file | ( | const Filename & | filename | ) |
Works like open_write_file(), but the file is opened in append mode.
Like open_write_file, the returned pointer should eventually be passed to close_write_file().
Definition at line 1012 of file virtualFileSystem.cxx.
References VirtualFileSimple::close_write_file(), close_write_file(), and VirtualFile::open_append_file().
Referenced by open_write_file().
iostream * VirtualFileSystem::open_read_append_file | ( | const Filename & | filename | ) |
Works like open_read_write_file(), but the file is opened in append mode.
Like open_read_write_file, the returned pointer should eventually be passed to close_read_write_file().
Definition at line 1076 of file virtualFileSystem.cxx.
References VirtualFileSimple::close_read_write_file(), close_read_write_file(), and VirtualFile::open_read_append_file().
Referenced by open_read_write_file().
istream * VirtualFileSystem::open_read_file | ( | const Filename & | filename, |
bool | auto_unwrap | ||
) | const |
Convenience function; returns a newly allocated istream if the file exists and can be read, or NULL otherwise.
Does not return an invalid istream.
If auto_unwrap is true, an explicitly-named .pz file is automatically decompressed and the decompressed contents are returned. This is different than vfs-implicit-pz, which will automatically decompress a file if the extension .pz is *not* given.
Definition at line 939 of file virtualFileSystem.cxx.
References VirtualFileSimple::close_read_file(), close_read_file(), and VirtualFile::open_read_file().
Referenced by ObjToEggConverter::convert_file(), get_global_ptr(), PNMImageHeader::make_reader(), PandaIOSystem::Open(), IffInputFile::open_read(), DXFFile::process(), XFile::read(), DCFile::read(), FltHeader::read_flt(), HashVal::set_from_bin(), x11GraphicsWindow::set_properties_now(), DownloadDb::set_server_multifile_hash(), and WavAudio::~WavAudio().
iostream * VirtualFileSystem::open_read_write_file | ( | const Filename & | filename, |
bool | truncate | ||
) |
Convenience function; returns a newly allocated iostream if the file exists and can be written, or NULL otherwise.
Does not return an invalid iostream.
Definition at line 1054 of file virtualFileSystem.cxx.
References VirtualFileSimple::close_read_write_file(), open_read_append_file(), and VirtualFile::open_read_write_file().
Referenced by close_write_file().
ostream * VirtualFileSystem::open_write_file | ( | const Filename & | filename, |
bool | auto_wrap, | ||
bool | truncate | ||
) |
Convenience function; returns a newly allocated ostream if the file exists and can be written, or NULL otherwise.
Does not return an invalid ostream.
If auto_wrap is true, an explicitly-named .pz file is automatically compressed while writing. If truncate is true, the file is truncated to zero length before writing.
Definition at line 990 of file virtualFileSystem.cxx.
References VirtualFileSimple::close_write_file(), open_append_file(), and VirtualFile::open_write_file().
Referenced by close_read_file(), Texture::ensure_loader_type(), PNMImageHeader::make_writer(), EggData::write_egg(), and EggToObjConverter::write_file().
|
static |
Parses one of the option flags in the options list on the vfs-mount Config.prc line.
Definition at line 1217 of file virtualFileSystem.cxx.
References VirtualFileComposite::add_component(), Filename::get_basename(), Filename::get_dirname(), Filename::get_extension(), Filename::get_filename_index(), Filename::get_fullpath(), VirtualFileMount::get_mount_point(), VirtualFile::get_original_filename(), Filename::get_type(), VirtualFileSimple::is_directory(), VirtualFile::is_directory(), Filename::is_local(), Filename::is_text(), VirtualFileMount::make_virtual_file(), Filename::set_binary(), VirtualFile::set_original_filename(), Filename::set_text(), Filename::set_type(), and Filename::standardize().
Referenced by parse_options().
|
static |
Parses all of the option flags in the options list on the vfs-mount Config.prc line.
Definition at line 1194 of file virtualFileSystem.cxx.
References parse_option().
Referenced by scan_mount_points().
|
inline |
Convenience function; fills the string up with the data from the indicated file, if it exists and can be read.
Returns true on success, false otherwise.
If auto_unwrap is true, an explicitly-named .pz file is automatically decompressed and the decompressed contents are returned. This is different than vfs-implicit-pz, which will automatically decompress a file if the extension .pz is *not* given.
Definition at line 153 of file virtualFileSystem.I.
References get_file().
|
inline |
Convenience function; fills the pvector up with the data from the indicated file, if it exists and can be read.
Returns true on success, false otherwise.
If auto_unwrap is true, an explicitly-named .pz file is automatically decompressed and the decompressed contents are returned. This is different than vfs-implicit-pz, which will automatically decompress a file if the extension .pz is *not* given.
Definition at line 172 of file virtualFileSystem.I.
References get_file().
bool VirtualFileSystem::rename_file | ( | const Filename & | orig_filename, |
const Filename & | new_filename | ||
) |
Attempts to move or rename the indicated file or directory.
If the original file is an ordinary file, it will quietly replace any already-existing file in the new filename (but not a directory). If the original file is a directory, the new filename must not already exist.
If the file is a directory, the new filename must be within the same mount point. If the file is an ordinary file, the new filename may be anywhere; but if it is not within the same mount point then the rename operation is automatically performed as a two-step copy-and-delete operation.
Definition at line 664 of file virtualFileSystem.cxx.
References copy_file().
Referenced by delete_file(), and BamCache::store().
bool VirtualFileSystem::resolve_filename | ( | Filename & | filename, |
const DSearchPath & | searchpath, | ||
const string & | default_extension = string() |
||
) | const |
Searches the given search path for the filename.
If it is found, updates the filename to the full pathname found and returns true; otherwise, returns false.
Definition at line 714 of file virtualFileSystem.cxx.
References find_all_files(), Filename::get_extension(), Filename::is_local(), and Filename::set_extension().
Referenced by SpeedTreeNode::add_from_stf(), copy_file(), Texture::finalize(), PathReplace::full_convert_path(), AudioManager::get_dls_pathname(), TexturePool::get_global_ptr(), OpenALAudioManager::is_valid(), FmodAudioManager::is_valid(), PathReplace::match_path(), EggData::resolve_egg_filename(), EggGroupNode::resolve_filenames(), RocketFileInterface::RocketFileInterface(), x11GraphicsWindow::set_properties_now(), OpenALAudioManager::uncache_sound(), ShaderPool::write(), and FontPool::write().
void VirtualFileSystem::scan_mount_points | ( | vector_string & | names, |
const Filename & | path | ||
) | const |
Adds to names a list of all the mount points in use that are one directory below path, if any.
That is, these are the external files or directories mounted directly to the indicated path.
The names vector is filled with a set of basenames, the basename part of the mount point.
Definition at line 1154 of file virtualFileSystem.cxx.
References Filename::get_fullpath(), VirtualFileMount::get_mount_point(), Filename::is_local(), and parse_options().
Referenced by atomic_read_contents(), and VirtualFile::scan_directory().
int VirtualFileSystem::unmount | ( | Multifile * | multifile | ) |
Unmounts all appearances of the indicated Multifile from the file system.
Returns the number of appearances unmounted.
Definition at line 231 of file virtualFileSystem.cxx.
References VirtualFileMount::get_mount_point(), VirtualFileMountMultifile::get_multifile(), and TypedObject::is_exact_type().
int VirtualFileSystem::unmount | ( | const Filename & | physical_filename | ) |
Unmounts all appearances of the indicated directory name or multifile name from the file system.
Returns the number of appearances unmounted.
Definition at line 276 of file virtualFileSystem.cxx.
References VirtualFileMount::get_mount_point(), VirtualFileMountMultifile::get_multifile(), Multifile::get_multifile_name(), VirtualFileMountSystem::get_physical_filename(), TypedObject::is_exact_type(), and unmount().
int VirtualFileSystem::unmount | ( | VirtualFileMount * | mount | ) |
Unmounts the indicated VirtualFileMount object from the file system.
Returns the number of appearances unmounted.
Definition at line 338 of file virtualFileSystem.cxx.
References VirtualFileMount::get_mount_point(), and unmount_point().
int VirtualFileSystem::unmount_all | ( | ) |
Unmounts all files from the file system.
Returns the number of systems unmounted.
Definition at line 412 of file virtualFileSystem.cxx.
References VirtualFileMount::get_mount_point(), and get_num_mounts().
Referenced by unmount_point().
int VirtualFileSystem::unmount_point | ( | const Filename & | mount_point | ) |
Unmounts all systems attached to the given mount point from the file system.
Returns the number of appearances unmounted.
Definition at line 374 of file virtualFileSystem.cxx.
References VirtualFileMount::get_mount_point(), and unmount_all().
Referenced by unmount().
void VirtualFileSystem::write | ( | ostream & | out | ) | const |
Print debugging information.
(e.g. from Python or gdb prompt).
Definition at line 802 of file virtualFileSystem.cxx.
References get_global_ptr().
Referenced by find_all_files().
|
inline |
Convenience function; writes the entire contents of the indicated file as a block of data.
If auto_wrap is true, an explicitly-named .pz file is automatically compressed while writing.
Definition at line 187 of file virtualFileSystem.I.
References create_file().