summaryrefslogtreecommitdiffstats
path: root/source/OSSupport
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/OSSupport/File.cpp14
-rw-r--r--source/OSSupport/File.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/source/OSSupport/File.cpp b/source/OSSupport/File.cpp
index cc0916711..871d9fb94 100644
--- a/source/OSSupport/File.cpp
+++ b/source/OSSupport/File.cpp
@@ -287,6 +287,20 @@ bool cFile::Rename(const AString & a_OrigFileName, const AString & a_NewFileName
+bool cFile::IsFolder(const AString & a_Path)
+{
+ #ifdef _WIN32
+ return ((GetFileAttributes(a_Path.c_str()) & FILE_ATTRIBUTE_DIRECTORY) != 0);
+ #else
+ struct stat st;
+ return ((stat(a_Path.c_str(), &st) == 0) && S_ISDIR(st.st_mode));
+ #endif
+}
+
+
+
+
+
int cFile::Printf(const char * a_Fmt, ...)
{
AString buf;
diff --git a/source/OSSupport/File.h b/source/OSSupport/File.h
index 8a057afa8..d4ea0d3a8 100644
--- a/source/OSSupport/File.h
+++ b/source/OSSupport/File.h
@@ -99,6 +99,9 @@ public:
/// Renames a file, returns true if successful. May fail if dest already exists (libc-dependant)!
static bool Rename(const AString & a_OrigFileName, const AString & a_NewFileName);
+ /// Returns true if the specified path is a folder
+ static bool IsFolder(const AString & a_Path);
+
int Printf(const char * a_Fmt, ...);
private: