Q_MKDIR: use std::filesystem::create_directories
This commit is contained in:
@@ -28,9 +28,6 @@
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
|
||||
#include "string/string.h"
|
||||
#include "os/path.h"
|
||||
|
||||
|
||||
#if defined ( POSIX )
|
||||
|
||||
@@ -134,3 +131,11 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateCo
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
bool Q_mkdir( const char* path ){
|
||||
std::error_code err;
|
||||
std::filesystem::create_directories( path, err );
|
||||
return !err;
|
||||
}
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ctime>
|
||||
|
||||
|
||||
// TTimo started adding portability code:
|
||||
// return true if spawning was successful, false otherwise
|
||||
@@ -47,14 +45,4 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateCo
|
||||
|
||||
// Q_mkdir
|
||||
// returns true if succeeded in creating directory
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
inline bool Q_mkdir( const char* name ){
|
||||
return _mkdir( name ) != -1;
|
||||
}
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
inline bool Q_mkdir( const char* name ){
|
||||
return mkdir( name, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ) != -1; // rwxrwxr-x
|
||||
}
|
||||
#endif
|
||||
bool Q_mkdir( const char* path );
|
||||
|
||||
Reference in New Issue
Block a user