mirror of https://github.com/AxioDL/amuse.git
Common.hpp: Refactor to remove <Windows.h> include
This commit is contained in:
parent
89986bdd65
commit
101746f268
|
@ -18,10 +18,6 @@
|
|||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#include <nowide/stackstring.hpp>
|
||||
#endif
|
||||
|
||||
|
@ -344,15 +340,11 @@ typedef struct stat Sstat;
|
|||
static inline int Stat(const char* path, Sstat* statout) { return stat(path, statout); }
|
||||
#endif
|
||||
|
||||
inline int Rename(const char* oldpath, const char* newpath) {
|
||||
#if _WIN32
|
||||
const nowide::wstackstring woldpath(oldpath);
|
||||
const nowide::wstackstring wnewpath(newpath);
|
||||
return MoveFileExW(woldpath.get(), wnewpath.get(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) == 0;
|
||||
int Rename(const char* oldpath, const char* newpath);
|
||||
#else
|
||||
return rename(oldpath, newpath);
|
||||
inline int Rename(const char* oldpath, const char* newpath) { return rename(oldpath, newpath); }
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int CompareCaseInsensitive(const char* a, const char* b) {
|
||||
#if _WIN32
|
||||
|
|
|
@ -3,6 +3,14 @@
|
|||
#ifndef _WIN32
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#else
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include <logvisor/logvisor.hpp>
|
||||
|
@ -47,6 +55,14 @@ bool Copy(const char* from, const char* to) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
int Rename(const char* oldpath, const char* newpath) {
|
||||
const nowide::wstackstring woldpath(oldpath);
|
||||
const nowide::wstackstring wnewpath(newpath);
|
||||
return MoveFileExW(woldpath.get(), wnewpath.get(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DEFINE_ID_TYPE(type, typeName) \
|
||||
thread_local NameDB* type::CurNameDB = nullptr; \
|
||||
template <> \
|
||||
|
|
Loading…
Reference in New Issue