mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-24 05:30:26 +08:00
64 lines
1.7 KiB
Diff
64 lines
1.7 KiB
Diff
|
db/c.cc | 2 ++
|
||
|
port/port_win.h | 7 +++++++
|
||
|
util/env_win.cc | 6 ++++--
|
||
|
3 files changed, 13 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/db/c.cc b/db/c.cc
|
||
|
index 08ff0ad..b23e3dc 100644
|
||
|
--- a/db/c.cc
|
||
|
+++ b/db/c.cc
|
||
|
@@ -5,7 +5,9 @@
|
||
|
#include "leveldb/c.h"
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
+#ifndef WIN32
|
||
|
#include <unistd.h>
|
||
|
+#endif
|
||
|
#include "leveldb/cache.h"
|
||
|
#include "leveldb/comparator.h"
|
||
|
#include "leveldb/db.h"
|
||
|
diff --git a/port/port_win.h b/port/port_win.h
|
||
|
index e8bf46e..989c15c 100644
|
||
|
--- a/port/port_win.h
|
||
|
+++ b/port/port_win.h
|
||
|
@@ -32,9 +32,16 @@
|
||
|
#define STORAGE_LEVELDB_PORT_PORT_WIN_H_
|
||
|
|
||
|
#ifdef _MSC_VER
|
||
|
+#if !(_MSC_VER >= 1900)
|
||
|
#define snprintf _snprintf
|
||
|
+#endif
|
||
|
#define close _close
|
||
|
#define fread_unlocked _fread_nolock
|
||
|
+#ifdef _WIN64
|
||
|
+#define ssize_t int64_t
|
||
|
+#else
|
||
|
+#define ssize_t int32_t
|
||
|
+#endif
|
||
|
#endif
|
||
|
|
||
|
#include <string>
|
||
|
diff --git a/util/env_win.cc b/util/env_win.cc
|
||
|
index d32c4e6..3b4c92b 100644
|
||
|
--- a/util/env_win.cc
|
||
|
+++ b/util/env_win.cc
|
||
|
@@ -761,14 +761,16 @@ uint64_t Win32Env::NowMicros()
|
||
|
static Status CreateDirInner( const std::string& dirname )
|
||
|
{
|
||
|
Status sRet;
|
||
|
- DWORD attr = ::GetFileAttributes(dirname.c_str());
|
||
|
+ std::wstring dirnameW;
|
||
|
+ ToWidePath(dirname, dirnameW);
|
||
|
+ DWORD attr = ::GetFileAttributesW(dirnameW.c_str());
|
||
|
if (attr == INVALID_FILE_ATTRIBUTES) { // doesn't exist:
|
||
|
std::size_t slash = dirname.find_last_of("\\");
|
||
|
if (slash != std::string::npos){
|
||
|
sRet = CreateDirInner(dirname.substr(0, slash));
|
||
|
if (!sRet.ok()) return sRet;
|
||
|
}
|
||
|
- BOOL result = ::CreateDirectory(dirname.c_str(), NULL);
|
||
|
+ BOOL result = ::CreateDirectoryW(dirnameW.c_str(), NULL);
|
||
|
if (result == FALSE) {
|
||
|
sRet = Status::IOError(dirname, "Could not create directory.");
|
||
|
return sRet;
|