File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 22
33#include " hal_core/utilities/log.h"
44
5+ #include < algorithm>
56#include < dirent.h>
67#include < fstream>
78#include < random>
@@ -37,11 +38,17 @@ namespace hal
3738#ifdef _WIN32
3839 DWORD ftyp = GetFileAttributesA (folder.c_str ());
3940 if (ftyp == INVALID_FILE_ATTRIBUTES)
41+ {
4042 return false ; // something is wrong with your path!
43+ }
4144
4245 if (ftyp & FILE_ATTRIBUTE_DIRECTORY)
46+ {
4347 if (0 == access (folder.c_str (), R_OK))
48+ {
4449 return true ;
50+ }
51+ }
4552
4653 return false ; // this is not a directory!
4754#else
@@ -65,7 +72,9 @@ namespace hal
6572#ifdef _WIN32
6673 DWORD ret = GetModuleFileNameA (NULL , buf, sizeof (buf));
6774 if (ret == 0 || ret == sizeof (buf))
75+ {
6876 return std::string ();
77+ }
6978 return std::filesystem::path (buf);
7079#elif __APPLE__ && __MACH__
7180 uint32_t size = sizeof (buf);
You can’t perform that action at this time.
0 commit comments