diff options
author | Kostas Nakos | 2009-08-08 09:38:12 +0000 |
---|---|---|
committer | Kostas Nakos | 2009-08-08 09:38:12 +0000 |
commit | 4f5e8e88cca8643cba1d155e1cbf4067c22d7bf1 (patch) | |
tree | c3d3c60095f21ef29501b12df2cac33aeac26d02 /backends/platform/wince | |
parent | 3e2ee197f186243df03cf4cea15d60c56ecc2bb9 (diff) | |
download | scummvm-rg350-4f5e8e88cca8643cba1d155e1cbf4067c22d7bf1.tar.gz scummvm-rg350-4f5e8e88cca8643cba1d155e1cbf4067c22d7bf1.tar.bz2 scummvm-rg350-4f5e8e88cca8643cba1d155e1cbf4067c22d7bf1.zip |
forward port of wince 3.0 fix for paths from branch 0.13.0, r39978
svn-id: r43114
Diffstat (limited to 'backends/platform/wince')
-rw-r--r-- | backends/platform/wince/missing/missing.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index ac93e8f714..2d9765b0f2 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -42,6 +42,7 @@ #endif #include "time.h" #include "dirent.h" +#include "common/debug.h" char *strdup(const char *strSource); @@ -182,11 +183,19 @@ int _access(const char *path, int mode) { HANDLE h = FindFirstFile(fname, &ffd); FindClose(h); - if (h == INVALID_HANDLE_VALUE) - return -1; //Can't find file + if (h == INVALID_HANDLE_VALUE) { + // WORKAROUND: WinCE 3.0 doesn't find paths ending in '\' + if (path[strlen(path)-1] == '\\') { + char p2[MAX_PATH]; + strncpy(p2, path, strlen(path)-1); + p2[strlen(path) - 1]= '\0'; + return _access(p2, mode); + } else + return -1; //Can't find file + } - if (ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) { - // WORKAROUND: WinCE (or the emulator) sometimes returns bogus direcotry + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + // WORKAROUND: WinCE (or the emulator) sometimes returns bogus directory // hits for files that don't exist. TRIPLE checking for the same fname // seems to weed out those false positives. // Exhibited in kyra engine. @@ -206,7 +215,7 @@ int _access(const char *path, int mode) { return 0; case 06: //Check Read & Write permission case 02: //Check Write permission - return ffd.dwFileAttributes&FILE_ATTRIBUTE_READONLY?-1:0; + return ffd.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? -1 : 0; case 04: //Check Read permission return 0; //Assume always have read permission } |