From 64ebd99c4c1e008587c794b86f1e47f8983face3 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Sun, 30 Oct 2011 23:45:39 +0200 Subject: [win] Fixed test aflet platform refactoring --- platform/platform_win.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'platform/platform_win.cpp') diff --git a/platform/platform_win.cpp b/platform/platform_win.cpp index b0013e7c95..4d454f22f2 100644 --- a/platform/platform_win.cpp +++ b/platform/platform_win.cpp @@ -1,11 +1,12 @@ #include "platform.hpp" +#include "../base/logging.hpp" + #include "../coding/file_writer.hpp" #include "../std/windows.hpp" #include -#include static bool GetUserWritableDir(string & outDir) { @@ -64,13 +65,13 @@ Platform::Platform() { FileWriter tmpfile(m_resourcesDir + "mapswithmetmptestfile"); tmpfile.Write("Hi from Alex!", 13); - FileWriter::DeleteFileX(m_resourcesDir + "mapswithmetmptestfile"); m_writableDir = m_resourcesDir; } - catch (FileWriter::RootException const &) + catch (RootException const &) { CHECK(GetUserWritableDir(m_writableDir), ("Can't get writable directory")); } + FileWriter::DeleteFileX(m_resourcesDir + "mapswithmetmptestfile"); LOG(LDEBUG, ("Resources Directory:", m_resourcesDir)); LOG(LDEBUG, ("Writable Directory:", m_writableDir)); @@ -82,8 +83,7 @@ Platform::~Platform() bool Platform::IsFileExists(string const & file) const { - struct _stat s; - return _stat(file.c_str(), &s) == 0; + return ::GetFileAttributesA(file.c_str()) != INVALID_FILE_ATTRIBUTES; } int Platform::CpuCores() const -- cgit v1.2.3