19 return get_file(filename,
true) !=
nullptr;
29 return (file !=
nullptr && file->is_directory());
39 return (file !=
nullptr && file->is_regular_file());
49 scan_directory(
const Filename &filename)
const {
51 if (file ==
nullptr) {
55 return file->scan_directory();
61 INLINE
void VirtualFileSystem::
64 if (file ==
nullptr) {
66 <<
"Not found: " << filename <<
"\n";
76 INLINE
void VirtualFileSystem::
77 ls_all(
const Filename &filename)
const {
79 if (file ==
nullptr) {
81 <<
"Not found: " << filename <<
"\n";
96 INLINE std::string VirtualFileSystem::
97 read_file(
const Filename &filename,
bool auto_unwrap)
const {
99 bool okflag = read_file(filename, result, auto_unwrap);
100 nassertr(okflag, std::string());
111 INLINE
bool VirtualFileSystem::
112 write_file(
const Filename &filename,
const std::string &data,
bool auto_wrap) {
113 return write_file(filename, (
const unsigned char *)data.data(), data.size(), auto_wrap);
126 INLINE
bool VirtualFileSystem::
127 read_file(
const Filename &filename, std::string &result,
bool auto_unwrap)
const {
129 return (file !=
nullptr && file->read_file(result, auto_unwrap));
142 INLINE
bool VirtualFileSystem::
143 read_file(
const Filename &filename, vector_uchar &result,
bool auto_unwrap)
const {
145 return (file !=
nullptr && file->read_file(result, auto_unwrap));
155 INLINE
bool VirtualFileSystem::
156 write_file(
const Filename &filename,
const unsigned char *data,
size_t data_size,
bool auto_wrap) {
158 return (file !=
nullptr && file->write_file(data, data_size, auto_wrap));
The abstract base class for a file or directory within the VirtualFileSystem.
PointerTo< VirtualFile > create_file(const Filename &filename)
Attempts to create a file by the indicated name in the filesystem, if possible, and returns it.
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.
bool is_directory(const Filename &filename) const
Convenience function; returns true if the named file exists and is a directory.
The name of a file, such as a texture file or an Egg file.
PT(VirtualFileList) VirtualFileSystem
If the file represents a directory (that is, is_directory() returns true), this returns the list of f...
PointerTo< VirtualFile > get_file(const Filename &filename, bool status_only=false) const
Looks up the file by the indicated name in the file system.
bool is_regular_file(const Filename &filename) const
Convenience function; returns true if the named file exists and is a regular file.