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

This commit is contained in:
rdb 2017-07-10 14:21:40 +02:00
parent 2e5051ac04
commit 5fffbbce47

View File

@ -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;
}