diff options
author | Yuri Gorshenin <y@maps.me> | 2015-05-27 19:11:28 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:48:59 +0300 |
commit | 8dfa6408167db3c75710bb92776127992c64c54b (patch) | |
tree | 434fd165cf74f31b9cd18f4ee8eac402e741d0f8 /platform/platform_win.cpp | |
parent | 4f5feeaa7303181f07cc08092d6fdf357b3b154c (diff) |
Review fixes.
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; |