15 #ifndef VIRTUALFILESYSTEM_H
16 #define VIRTUALFILESYSTEM_H
18 #include "pandabase.h"
20 #include "virtualFile.h"
21 #include "virtualFileMount.h"
22 #include "virtualFileList.h"
24 #include "dSearchPath.h"
25 #include "pointerTo.h"
26 #include "config_express.h"
27 #include "mutexImpl.h"
50 MF_read_only = 0x0002,
53 BLOCKING
bool mount(
Multifile *multifile,
const Filename &mount_point,
int flags);
54 BLOCKING
bool mount(
const Filename &physical_filename,
const Filename &mount_point,
55 int flags,
const string &password =
"");
56 BLOCKING
bool mount_loop(
const Filename &virtual_filename,
const Filename &mount_point,
57 int flags,
const string &password =
"");
59 BLOCKING
int unmount(
Multifile *multifile);
60 BLOCKING
int unmount(
const Filename &physical_filename);
62 BLOCKING
int unmount_point(
const Filename &mount_point);
63 BLOCKING
int unmount_all();
65 int get_num_mounts()
const;
67 MAKE_SEQ(get_mounts, get_num_mounts, get_mount);
69 BLOCKING
bool chdir(
const Filename &new_directory);
71 BLOCKING
bool make_directory(
const Filename &filename);
72 BLOCKING
bool make_directory_full(
const Filename &filename);
74 BLOCKING PT(
VirtualFile) get_file(
const Filename &filename,
bool status_only =
false)
const;
78 bool status_only =
false)
const;
79 BLOCKING
bool delete_file(
const Filename &filename);
80 BLOCKING
bool rename_file(
const Filename &orig_filename,
const Filename &new_filename);
81 BLOCKING
bool copy_file(
const Filename &orig_filename,
const Filename &new_filename);
84 const string &default_extension =
string())
const;
88 BLOCKING INLINE
bool exists(
const Filename &filename)
const;
89 BLOCKING INLINE
bool is_directory(
const Filename &filename)
const;
90 BLOCKING INLINE
bool is_regular_file(
const Filename &filename)
const;
94 INLINE
void ls(
const Filename &filename)
const;
95 INLINE
void ls_all(
const Filename &filename)
const;
97 void write(ostream &out)
const;
101 EXTENSION(BLOCKING PyObject *read_file(
const Filename &filename,
bool auto_unwrap)
const);
102 BLOCKING istream *open_read_file(
const Filename &filename,
bool auto_unwrap)
const;
103 BLOCKING
static void close_read_file(istream *stream);
105 EXTENSION(BLOCKING PyObject *write_file(
const Filename &filename, PyObject *data,
bool auto_wrap));
106 BLOCKING ostream *open_write_file(
const Filename &filename,
bool auto_wrap,
bool truncate);
107 BLOCKING ostream *open_append_file(
const Filename &filename);
108 BLOCKING
static void close_write_file(ostream *stream);
110 BLOCKING iostream *open_read_write_file(
const Filename &filename,
bool truncate);
111 BLOCKING iostream *open_read_append_file(
const Filename &filename);
112 BLOCKING
static void close_read_write_file(iostream *stream);
116 BLOCKING INLINE
string read_file(
const Filename &filename,
bool auto_unwrap)
const;
117 BLOCKING INLINE
bool write_file(
const Filename &filename,
const string &data,
bool auto_wrap);
119 bool atomic_compare_and_exchange_contents(
const Filename &filename,
string &orig_contents,
const string &old_contents,
const string &new_contents);
120 bool atomic_read_contents(
const Filename &filename,
string &contents)
const;
122 INLINE
bool read_file(
const Filename &filename,
string &result,
bool auto_unwrap)
const;
124 INLINE
bool write_file(
const Filename &filename,
const unsigned char *data,
size_t data_size,
bool auto_wrap);
126 void scan_mount_points(vector_string &names,
const Filename &path)
const;
128 static void parse_options(
const string &options,
129 int &flags,
string &password);
130 static void parse_option(
const string &
option,
131 int &flags,
string &password);
138 OF_status_only = 0x0001,
139 OF_create_file = 0x0002,
140 OF_make_directory = 0x0004,
141 OF_allow_nonexist = 0x0008,
158 const Filename &original_filename,
bool implicit_pz_file,
159 int open_flags)
const;
160 bool consider_mount_mf(
const Filename &filename);
165 unsigned int _mount_seq;
172 #include "virtualFileSystem.I"
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.
This is a convenience class to specialize ConfigVariable as a boolean type.
The abstract base class for a file or directory within the VirtualFileSystem.
A list of VirtualFiles, as returned by VirtualFile::scan_directory().
The name of a file, such as a texture file or an Egg file.
The abstract base class for a mount definition used within a VirtualFileSystem.
A file that contains a set of files.
This class stores a list of directories that can be searched, in order, to locate a particular file...
A fake mutex implementation for single-threaded applications that don't need any synchronization cont...
A composite directory within the VirtualFileSystem: this maps to more than one directory on different...