Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions OpenSim/Common/IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "Logger.h"
#include <climits>
#include <filesystem>
#include <limits>
#include <math.h>
#include <string>
Expand Down Expand Up @@ -520,12 +521,9 @@ stod(const std::string& __str, std::size_t* __idx)
int IO::
makeDir(const string &aDirName)
{

#if defined __linux__ || defined __APPLE__
return mkdir(aDirName.c_str(),S_IRWXU);
#else
return _mkdir(aDirName.c_str());
#endif
std::error_code error;
std::filesystem::create_directory(aDirName, error);
return error.value();
}
//_____________________________________________________________________________
/**
Expand All @@ -535,13 +533,9 @@ makeDir(const string &aDirName)
int IO::
chDir(const string &aDirName)
{

#if defined __linux__ || defined __APPLE__
return chdir(aDirName.c_str());
#else
return _chdir(aDirName.c_str());
#endif

std::error_code error;
std::filesystem::current_path(aDirName, error);
return error.value();
}
//_____________________________________________________________________________
/**
Expand All @@ -551,13 +545,7 @@ chDir(const string &aDirName)
string IO::
getCwd()
{
char buffer[PATH_MAX];
#if defined __linux__ || defined __APPLE__
auto ptr = getcwd(buffer, PATH_MAX); (void)ptr;
#else
_getcwd(buffer, PATH_MAX);
#endif
return string(buffer);
return std::filesystem::current_path().string();
}

//_____________________________________________________________________________
Expand Down
Loading