diff --git a/ChangeLog b/ChangeLog index 280177f6..bc116963 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16485,3 +16485,5 @@ * Fixed a race in the 'Export' Web API call. 2017-12-15 Fred Gleason * Removed the 'RDTempDir()' function. +2017-12-15 Fred Gleason + * Fixed bugs that caused the build to break under Windows. diff --git a/lib/rdtempdirectory.cpp b/lib/rdtempdirectory.cpp index 449fd555..4a4e7f45 100644 --- a/lib/rdtempdirectory.cpp +++ b/lib/rdtempdirectory.cpp @@ -20,8 +20,11 @@ #include #include +#ifndef WIN32 #include +#endif // WIN32 +#include #include #include "rdconfig.h" @@ -41,7 +44,7 @@ RDTempDirectory::~RDTempDirectory() for(unsigned i=0;iremove(files[i]); } - rmdir(temp_dir->path()); + temp_dir->rmdir(temp_dir->path()); delete temp_dir; } } @@ -58,6 +61,17 @@ QString RDTempDirectory::path() const bool RDTempDirectory::create(QString *err_msg) { +#ifdef WIN32 + QDateTime now=QDateTime::currentDateTime(); + QString tempdir=RDTempDirectory::basePath()+"/"+temp_base_name+ + QString().sprintf("%u",now.toTime_t()); + temp_dir=new QDir(tempdir); + if(!temp_dir->mkdir(tempdir)) { + *err_msg="unable to create temp directory"; + delete temp_dir; + return false; + } +#else char tempdir[PATH_MAX]; strncpy(tempdir,RDTempDirectory::basePath(),PATH_MAX); @@ -69,6 +83,7 @@ bool RDTempDirectory::create(QString *err_msg) return false; } temp_dir=new QDir(tempdir); +#endif // WIN32 return true; } diff --git a/lib/rdtextfile.cpp b/lib/rdtextfile.cpp index 3e229a98..bb1ca19b 100644 --- a/lib/rdtextfile.cpp +++ b/lib/rdtextfile.cpp @@ -49,7 +49,7 @@ bool RDTextFile(const QString &data) editor=getenv("VISUAL"); } #ifdef WIN32 - QString tempfile=QString().sprintf("%s\\rd-%s",(const char *)RDTempDir(), + QString tempfile=QString().sprintf("%s\\rd-%s",(const char *)RDTempDirectory::basePath(), (const char *)QTime::currentTime().toString("hhmmsszzz")); FILE *f=fopen(tempfile,"w"); if(f==NULL) {