From 8e017c87c314a190854150fc1e2719ee7a3d176c Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 21 May 2013 18:15:15 +0000 Subject: [PATCH] Workaround for using (windows) directories insides cue files on Linux. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3830 --- src/dos/cdrom_image.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/dos/cdrom_image.cpp b/src/dos/cdrom_image.cpp index f98c6f2b..f636a7e5 100644 --- a/src/dos/cdrom_image.cpp +++ b/src/dos/cdrom_image.cpp @@ -658,7 +658,30 @@ bool CDROM_Interface_Image::GetRealFileName(string &filename, string &pathname) return true; } } - +#if defined (WIN32) || defined(OS2) + //Nothing +#else + //Consider the possibility that the filename has a windows directory seperator (inside the CUE file) + //which is common for some commercial rereleases of DOS games using DOSBox + + string copy = filename; + size_t l = copy.size(); + for (size_t i = 0; i < l;i++) { + if(copy[i] == '\\') copy[i] = '/'; + } + + if (stat(copy.c_str(), &test) == 0) { + filename = copy; + return true; + } + + tmpstr = pathname + "/" + copy; + if (stat(tmpstr.c_str(), &test) == 0) { + filename = tmpstr; + return true; + } + +#endif return false; }