20 return get_file(filename,
true) !=
nullptr;
30 return (file !=
nullptr && file->is_directory());
40 return (file !=
nullptr && file->is_regular_file());
50scan_directory(
const Filename &filename)
const {
52 if (file ==
nullptr) {
56 return file->scan_directory();
62INLINE
void VirtualFileSystem::
65 if (file ==
nullptr) {
67 <<
"Not found: " << filename <<
"\n";
77INLINE
void VirtualFileSystem::
78ls_all(
const Filename &filename)
const {
80 if (file ==
nullptr) {
82 <<
"Not found: " << filename <<
"\n";
97INLINE std::string VirtualFileSystem::
98read_file(
const Filename &filename,
bool auto_unwrap)
const {
100 bool okflag = read_file(filename, result, auto_unwrap);
101 nassertr(okflag, std::string());
112INLINE
bool VirtualFileSystem::
113write_file(
const Filename &filename,
const std::string &data,
bool auto_wrap) {
114 return write_file(filename, (
const unsigned char *)data.data(), data.size(), auto_wrap);
127INLINE
bool VirtualFileSystem::
128read_file(
const Filename &filename, std::string &result,
bool auto_unwrap)
const {
130 return (file !=
nullptr && file->read_file(result, auto_unwrap));
143INLINE
bool VirtualFileSystem::
144read_file(
const Filename &filename, vector_uchar &result,
bool auto_unwrap)
const {
146 return (file !=
nullptr && file->read_file(result, auto_unwrap));
156INLINE
bool VirtualFileSystem::
157write_file(
const Filename &filename,
const unsigned char *data,
size_t data_size,
bool auto_wrap) {
159 return (file !=
nullptr && file->write_file(data, data_size, auto_wrap));
The name of a file, such as a texture file or an Egg file.
A list of VirtualFiles, as returned by VirtualFile::scan_directory().
bool exists(const Filename &filename) const
Convenience function; returns true if the named file exists in the virtual file system hierarchy.
bool is_regular_file(const Filename &filename) const
Convenience function; returns true if the named file exists as a regular file in the virtual file sys...
PointerTo< VirtualFile > create_file(const Filename &filename)
Attempts to create a file by the indicated name in the filesystem, if possible, and returns it.
bool is_directory(const Filename &filename) const
Convenience function; returns true if the named file exists as a directory in the virtual file system...
PointerTo< VirtualFile > get_file(const Filename &filename, bool status_only=false) const
Looks up the file by the indicated name in the file system.
The abstract base class for a file or directory within the VirtualFileSystem.