diff options
Diffstat (limited to 'platform/platform_win.cpp')
-rw-r--r-- | platform/platform_win.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/platform/platform_win.cpp b/platform/platform_win.cpp index 1025f80e20..5e48ea360e 100644 --- a/platform/platform_win.cpp +++ b/platform/platform_win.cpp @@ -8,7 +8,10 @@ #include "std/windows.hpp" #include "std/bind.hpp" +#include <direct.h> #include <shlobj.h> +#include <sys/types.h> +#include <sys/stat.h> static bool GetUserWritableDir(string & outDir) { @@ -91,6 +94,29 @@ bool Platform::IsFileExistsByFullPath(string const & filePath) return ::GetFileAttributesA(filePath.c_str()) != INVALID_FILE_ATTRIBUTES; } +// static +Platform::EError Platform::RmDir(string const & dirName) +{ + if (_rmdir(dirName.c_str()) != 0) + return ErrnoToError(); + return ERR_OK; +} + +// static +Platform::EError Platform::GetFileType(string const & path, EFileType & type) +{ + struct _stat32 stats; + if (_stat32(path.c_str(), &stats) != 0) + return ErrnoToError(); + if (stats.st_mode & _S_IFREG) + type = FILE_TYPE_REGULAR; + else if (stats.st_mode & _S_IFDIR) + type = FILE_TYPE_DIRECTORY; + else + type = FILE_TYPE_UNKNOWN; + return ERR_OK; +} + int Platform::CpuCores() const { SYSTEM_INFO sysinfo; |