mirror of
https://github.com/libAthena/athena.git
synced 2025-12-09 21:47:52 +00:00
MSVC build fixes
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
#include "Athena/Dir.hpp"
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define stat64 __stat64
|
||||
#define realpath(__name, __resolved) _fullpath((__name), (__resolved), 4096)
|
||||
@@ -64,7 +70,11 @@ bool Dir::touch()
|
||||
|
||||
bool Dir::mkdir(const std::string& dir, mode_t mode)
|
||||
{
|
||||
#if _WIN32
|
||||
return !(::_mkdir(dir.c_str()) < 0);
|
||||
#else
|
||||
return !(::mkdir(dir.c_str(), mode) < 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Dir::mkpath(const std::string& path, mode_t mode)
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
#include "Athena/Utility.hpp"
|
||||
#include "Athena/FileWriter.hpp"
|
||||
#include "Athena/FileReader.hpp"
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#if !(defined(HW_DOL) || defined(HW_RVL) || defined(_WIN32))
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
@@ -24,7 +27,7 @@
|
||||
#include <functional>
|
||||
#include <locale>
|
||||
#define stat64 __stat64
|
||||
#define realpath(__name, __resolved) _fullpath((__name), (__resolved), 4096)
|
||||
#define realpath(__name, __resolved) _fullpath((__resolved), (__name), 4096)
|
||||
#endif
|
||||
|
||||
namespace Athena
|
||||
@@ -126,7 +129,7 @@ bool FileInfo::touch() const
|
||||
HANDLE fh;
|
||||
wchar_t date[80], time[80];
|
||||
|
||||
fh = CreateFileW(path, GENERIC_READ | FILE_WRITE_ATTRIBUTES, 0, NULL, CREATE_NEW, 0, NULL);
|
||||
fh = CreateFileA(m_path.c_str(), GENERIC_READ | FILE_WRITE_ATTRIBUTES, 0, NULL, CREATE_NEW, 0, NULL);
|
||||
if (fh == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user