diff options
author | Kostas Nakos | 2007-10-28 18:51:05 +0000 |
---|---|---|
committer | Kostas Nakos | 2007-10-28 18:51:05 +0000 |
commit | 065145ef2dd9ce1820332ab465480ffea8cc580e (patch) | |
tree | e20244f19b256e50e281de5b1fcb5d424b987368 /backends | |
parent | 0e026d2b995eadd6c13c92eeb6b6b033eab01ffe (diff) | |
download | scummvm-rg350-065145ef2dd9ce1820332ab465480ffea8cc580e.tar.gz scummvm-rg350-065145ef2dd9ce1820332ab465480ffea8cc580e.tar.bz2 scummvm-rg350-065145ef2dd9ce1820332ab465480ffea8cc580e.zip |
new stuff to support the FS api and fixes for the new compiler
svn-id: r29308
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/wince/missing/missing.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp index b00c98db59..76faf7ea8c 100644 --- a/backends/platform/wince/missing/missing.cpp +++ b/backends/platform/wince/missing/missing.cpp @@ -178,6 +178,42 @@ EXT_C FILE *wce_fopen(const char* fname, const char* fmode) return fopen(fname, fmode); } +/* Remove file by name */ +int remove(const char* path) +{ + TCHAR pathUnc[MAX_PATH+1]; + MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH); + return !DeleteFile(pathUnc); +} + + +/* check out file access permissions */ +int _access(const char *path, int mode) { + TCHAR fname[MAX_PATH]; + MultiByteToWideChar(CP_ACP, 0, path, -1, fname, sizeof(fname)/sizeof(TCHAR)); + + WIN32_FIND_DATA ffd; + HANDLE h=FindFirstFile(fname, &ffd); + + if (h == INVALID_HANDLE_VALUE) + return -1; //Can't find file + FindClose(h); + + if (ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) + return 0; //Always return success if target is directory and exists + + switch (mode) { + case 00: //Check existence + return 0; + case 06: //Check Read & Write permission + case 02: //Check Write permission + return ffd.dwFileAttributes&FILE_ATTRIBUTE_READONLY?-1:0; + case 04: //Check Read permission + return 0; //Assume always have read permission + } + //Bad mode value supplied, return failure + return -1; +} // evc only functions follow #ifndef __GNUC__ @@ -283,14 +319,6 @@ int closedir(DIR* dir) return 1; } -/* Remove file by name */ -int remove(const char* path) -{ - TCHAR pathUnc[MAX_PATH+1]; - MultiByteToWideChar(CP_ACP, 0, path, -1, pathUnc, MAX_PATH); - return !DeleteFile(pathUnc); -} - /* in our case unlink is the same as remove */ int unlink(const char* path) { @@ -662,6 +690,7 @@ long int strtol(const char *nptr, char **endptr, int base) { // gcc build only functions follow #else // defined(__GNUC__) +#ifndef __MINGW32CE__ int islower(int c) { return (c>='a' && c<='z'); @@ -696,3 +725,5 @@ extern "C" int atexit(void (*function)(void)) return 0; } #endif + +#endif |