diff --git a/include/CoolPropTools.h b/include/CoolPropTools.h index 78de0122..40afe0ce 100644 --- a/include/CoolPropTools.h +++ b/include/CoolPropTools.h @@ -116,7 +116,8 @@ } /// Get the size of a directory in bytes; from http://stackoverflow.com/a/17827724/1360263 inline unsigned long long CalculateDirSize(const std::string &path){ - return CalculateDirSize(std::wstring(path.begin(), path.end())); + std::wstring wpath(path.begin(), path.end()); + return CalculateDirSize(wpath); } inline unsigned long long CalculateDirSize(const std::wstring &path, std::vector *errVect = NULL, unsigned long long size = 0) { diff --git a/src/CoolPropTools.cpp b/src/CoolPropTools.cpp index d67e4d5e..f5ee8404 100644 --- a/src/CoolPropTools.cpp +++ b/src/CoolPropTools.cpp @@ -23,7 +23,8 @@ int ftw_function(const char *fpath, const struct stat *sb, int tflag, struct FTW return 0; /* To tell nftw() to continue */ } unsigned long long CalculateDirSize(const std::wstring &path){ - return CalculateDirSize(std::string(path.begin(), path.end())) + std::string path(path.begin(), path.end()); + return CalculateDirSize(path); } unsigned long long CalculateDirSize(const std::string &path){ ftw_summer = 0;