File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -85,3 +85,21 @@ int fossil_sanity_sys_file_exists(const char* filename) {
8585 return (stat (filename , & buffer ) == 0 ); // On Unix-like systems, use the stat function to check if the file exists.
8686#endif
8787}
88+
89+ int fossil_sanity_sys_create_dir (const char * dirname ) {
90+ #ifdef _WIN32
91+ return CreateDirectoryA (dirname , NULL ) ? 0 : -1 ; // On Windows, use the CreateDirectoryA function to create the directory.
92+ #else
93+ return mkdir (dirname , 0755 ); // On Unix-like systems, use the mkdir function to create the directory.
94+ #endif
95+ }
96+
97+ int fossil_sanity_sys_dir_exists (const char * dirname ) {
98+ #ifdef _WIN32
99+ struct _stat buffer ;
100+ return (_stat (dirname , & buffer ) == 0 && (buffer .st_mode & _S_IFDIR )); // On Windows, use the _stat function to check if the directory exists.
101+ #else
102+ struct stat buffer ;
103+ return (stat (dirname , & buffer ) == 0 && S_ISDIR (buffer .st_mode )); // On Unix-like systems, use the stat function to check if the directory exists.
104+ #endif
105+ }
You can’t perform that action at this time.
0 commit comments