Skip to content

Commit b5cf170

Browse files
authored
Merge pull request #17 from osorensen/windows-build-issue
fixed mkdir issue on Windows
2 parents 9d029e9 + f638679 commit b5cf170

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Makevars.win

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
CXX_STD = CXX17
2+
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
3+
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

src/parameter_tracer.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <sys/stat.h>
2+
#include <string>
23
#include <cstdlib>
34
#include <sstream>
45
#include "parameter_tracer.h"
@@ -7,7 +8,13 @@ using namespace arma;
78
ParameterTracer::ParameterTracer(bool trace, bool trace_latent, const std::string& trace_directory)
89
: trace { trace }, trace_latent { trace_latent }, trace_directory { trace_directory } {
910
if(trace) {
11+
#ifdef _WIN32
12+
// On Windows, mkdir takes only one argument
13+
int status = mkdir(trace_directory.c_str());
14+
#else
15+
// On POSIX systems, mkdir takes two arguments
1016
int status = mkdir(trace_directory.c_str(), 0777);
17+
#endif
1118
if (status != 0) {
1219
Rcpp::stop("Error creating trace directory.");
1320
}

0 commit comments

Comments
 (0)