Skip to content
Snippets Groups Projects
Commit de050256 authored by Kenneth Lausdahl's avatar Kenneth Lausdahl
Browse files

fixed filesystem for windows

parent 46e67514
No related branches found
No related tags found
No related merge requests found
...@@ -73,7 +73,8 @@ bool removePath(const std::string& path) ...@@ -73,7 +73,8 @@ bool removePath(const std::string& path)
if (path.size() < 1 || !isDirExist(path)) if (path.size() < 1 || !isDirExist(path))
return false; return false;
#if defined(_WIN32) #if defined(_WIN32)
//TODO //FIXME
return true;
#else #else
auto cmd = make_shared<std::string>("rm -r "); auto cmd = make_shared<std::string>("rm -r ");
cmd->append(path); cmd->append(path);
...@@ -93,9 +94,9 @@ shared_ptr<string> getTempDir() ...@@ -93,9 +94,9 @@ shared_ptr<string> getTempDir()
DWORD dwBytesWritten; DWORD dwBytesWritten;
DWORD dwBufSize=BUFSIZE; DWORD dwBufSize=BUFSIZE;
UINT uRetVal; UINT uRetVal;
WCHAR szTempName[BUFSIZE]; char szTempName[BUFSIZE];
char buffer[BUFSIZE]; char buffer[BUFSIZE];
WCHAR lpPathBuffer[BUFSIZE]; char lpPathBuffer[BUFSIZE];
BOOL fSuccess; BOOL fSuccess;
dwRetVal = GetTempPath(dwBufSize, // length of the buffer dwRetVal = GetTempPath(dwBufSize, // length of the buffer
...@@ -107,13 +108,14 @@ shared_ptr<string> getTempDir() ...@@ -107,13 +108,14 @@ shared_ptr<string> getTempDir()
// Create a temporary file. // Create a temporary file.
uRetVal = GetTempFileName(lpPathBuffer,// directory for tmp files uRetVal = GetTempFileName(lpPathBuffer,// directory for tmp files
L"fmu-",// temp file name prefix "fmu-",// temp file name prefix
0,// create unique name 0,// create unique name
szTempName);// buffer for name szTempName);// buffer for name
if (uRetVal == 0) if (uRetVal == 0)
{ {
return NULL; return NULL;
} }
return make_shared<string>(szTempName); return make_shared<string>(szTempName);
#else #else
char template_name[] = "/tmp/fmu-XXXXXX"; char template_name[] = "/tmp/fmu-XXXXXX";
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
// A safer version for string manipulation // A safer version for string manipulation
#include <strsafe.h> #include <strsafe.h>
#include <memory>
#else #else
#include <stdlib.h> #include <stdlib.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment