瀏覽代碼

express: error if Windows-style path is used (LP 1429241)

rdb 8 年之前
父節點
當前提交
5fffbbce47
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      panda/src/express/virtualFileSystem.cxx

+ 18 - 0
panda/src/express/virtualFileSystem.cxx

@@ -1226,6 +1226,24 @@ do_get_file(const Filename &filename, int open_flags) const {
     }
     }
   }
   }
 
 
+#if defined(_WIN32) && !defined(NDEBUG)
+  if (!found_file) {
+    // The file could not be found.  Perhaps this is because the user passed
+    // in a Windows-style path where a Unix-style path was expected?
+    if (filename.length() > 2 && isalpha(filename[0]) && filename[1] == ':' &&
+        (filename[2] == '\\' || filename[2] == '/')) {
+
+      Filename corrected_fn = Filename::from_os_specific(filename);
+      if (corrected_fn.exists()) {
+        express_cat.warning()
+          << "Filename uses Windows-style path: " << filename << "\n";
+        express_cat.warning()
+          << "  expected Unix-style path: " << corrected_fn << "\n";
+      }
+    }
+  }
+#endif
+
   return found_file;
   return found_file;
 }
 }