Переглянути джерело

express: Fix VFS mount points not being listed as directories

Fixes #1244
rdb 1 рік тому
батько
коміт
0a4d22ad9f

+ 5 - 0
panda/src/express/virtualFileMountRamdisk.cxx

@@ -30,6 +30,7 @@ TypeHandle VirtualFileMountRamdisk::Directory::_type_handle;
  */
 VirtualFileMountRamdisk::
 VirtualFileMountRamdisk() : _root("") {
+  _root.local_object();
 }
 
 /**
@@ -477,6 +478,10 @@ PT(VirtualFileMountRamdisk::FileBase) VirtualFileMountRamdisk::Directory::
 do_find_file(const string &filename) const {
   size_t slash = filename.find('/');
   if (slash == string::npos) {
+    if (filename.empty()) {
+      return (FileBase *)this;
+    }
+
     // Search for a file within the local directory.
     FileBase tfile(filename);
     tfile.local_object();

+ 1 - 1
panda/src/express/virtualFileSystem.cxx

@@ -1051,7 +1051,7 @@ scan_mount_points(vector_string &names, const Filename &path) const {
           mount_point[prefix.length()] == '/') {
         // This mount point is below the indicated path.  Is it only one
         // directory below?
-        string basename = mount_point.substr(prefix.length());
+        string basename = mount_point.substr(prefix.length() + 1);
         if (basename.find('/') == string::npos) {
           // No embedded slashes, so it's only one directory below.
           names.push_back(basename);