[Scummvm-cvs-logs] SF.net SVN: scummvm: [29308] scummvm/trunk/backends/platform/wince/missing/ missing.cpp
knakos at users.sourceforge.net
knakos at users.sourceforge.net
Sun Oct 28 19:51:06 CET 2007
Revision: 29308
http://scummvm.svn.sourceforge.net/scummvm/?rev=29308&view=rev
Author: knakos
Date: 2007-10-28 11:51:05 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
new stuff to support the FS api and fixes for the new compiler
Modified Paths:
--------------
scummvm/trunk/backends/platform/wince/missing/missing.cpp
Modified: scummvm/trunk/backends/platform/wince/missing/missing.cpp
===================================================================
--- scummvm/trunk/backends/platform/wince/missing/missing.cpp 2007-10-28 18:48:07 UTC (rev 29307)
+++ scummvm/trunk/backends/platform/wince/missing/missing.cpp 2007-10-28 18:51:05 UTC (rev 29308)
@@ -178,7 +178,43 @@
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 @@
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 @@
// gcc build only functions follow
#else // defined(__GNUC__)
+#ifndef __MINGW32CE__
int islower(int c)
{
return (c>='a' && c<='z');
@@ -696,3 +725,5 @@
return 0;
}
#endif
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list