From 5fffbbce47c79992f74bbb11e22085fe124f61a7 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Jul 2017 14:21:40 +0200 Subject: [PATCH] express: error if Windows-style path is used (LP 1429241) --- panda/src/express/virtualFileSystem.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/panda/src/express/virtualFileSystem.cxx b/panda/src/express/virtualFileSystem.cxx index c331dd1055..da7797ec9d 100644 --- a/panda/src/express/virtualFileSystem.cxx +++ b/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; }