diff --git a/libretroshare/src/util/rsdir.cc b/libretroshare/src/util/rsdir.cc index 95dbaca3e..0eff04428 100644 --- a/libretroshare/src/util/rsdir.cc +++ b/libretroshare/src/util/rsdir.cc @@ -34,6 +34,8 @@ #include #include #include +#include + #if defined(WIN32) || defined(__CYGWIN__) #include "wtypes.h" @@ -232,51 +234,42 @@ bool RsDirUtil::checkDirectory(std::string dir) bool RsDirUtil::checkCreateDirectory(std::string dir) { - struct stat buf; - int val = stat(dir.c_str(), &buf); - if (val == -1) - { - // directory don't exist. create. +#ifdef RSDIR_DEBUG + std::cerr << "RsDirUtil::checkCreateDirectory() dir: " << dir << std::endl; +#endif + DIR *direc = opendir(dir.c_str()); + if (!direc) + { + // directory don't exist. create. /******************************** WINDOWS/UNIX SPECIFIC PART ******************/ #ifndef WINDOWS_SYS // UNIX - if (-1 == mkdir(dir.c_str(), 0777)) + if (-1 == mkdir(dir.c_str(), 0777)) #else // WIN - if (-1 == mkdir(dir.c_str())) + if (-1 == mkdir(dir.c_str())) #endif /******************************** WINDOWS/UNIX SPECIFIC PART ******************/ - { -#ifdef RSDIR_DEBUG - std::cerr << "check_create_directory() Fatal Error --"; - std::cerr < //#include //#include //#include