From 8dfa6408167db3c75710bb92776127992c64c54b Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Wed, 27 May 2015 19:11:28 +0300 Subject: Review fixes. --- platform/platform_win.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'platform/platform_win.cpp') 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 #include +#include +#include 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; -- cgit v1.2.3