60 lines
1.3 KiB
Diff
60 lines
1.3 KiB
Diff
diff -r 084988518fe8 src/common/basics.cpp
|
|
--- src/common/basics.cpp Sat Apr 26 09:27:35 2014 -0400
|
|
+++ src/common/basics.cpp Sat Apr 26 09:42:07 2014 -0400
|
|
@@ -1115,6 +1115,28 @@
|
|
return 0;
|
|
}
|
|
|
|
+//FIXME: Why negative?
|
|
+bool isNotDirectory(const char *filename)
|
|
+{
|
|
+#if !defined(__WIN32__) && !defined(__WIN64__)
|
|
+ struct stat statbuf;
|
|
+
|
|
+ if(stat(filename,&statbuf) == -1)
|
|
+ return false;
|
|
+
|
|
+ return (statbuf.st_mode !=S_IFDIR);
|
|
+#else
|
|
+
|
|
+ WARN(false, "Untested function. calling win api");
|
|
+ DWORD fileAttribs;
|
|
+ fileAttribs=GetFileAttributes((LPCWSTR)filename);
|
|
+ if(fileAttribs == INVALID_FILE_ATTRIBUTES)
|
|
+ return false;
|
|
+
|
|
+ return !(fileAttribs & FILE_ATTRIBUTE_DIRECTORY);
|
|
+#endif
|
|
+}
|
|
+
|
|
#ifdef DEBUG
|
|
bool isValidXML(const char *filename)
|
|
{
|
|
@@ -1148,27 +1170,6 @@
|
|
}
|
|
|
|
|
|
-//FIXME: Why negative?
|
|
-bool isNotDirectory(const char *filename)
|
|
-{
|
|
-#if !defined(__WIN32__) && !defined(__WIN64__)
|
|
- struct stat statbuf;
|
|
-
|
|
- if(stat(filename,&statbuf) == -1)
|
|
- return false;
|
|
-
|
|
- return (statbuf.st_mode !=S_IFDIR);
|
|
-#else
|
|
-
|
|
- WARN(false, "Untested function. calling win api");
|
|
- DWORD fileAttribs;
|
|
- fileAttribs=GetFileAttributes((LPCWSTR)filename);
|
|
- if(fileAttribs == INVALID_FILE_ATTRIBUTES)
|
|
- return false;
|
|
-
|
|
- return !(fileAttribs & FILE_ATTRIBUTE_DIRECTORY);
|
|
-#endif
|
|
-}
|
|
|
|
bool rmFile(const std::string &filename)
|
|
{
|