34 # define access _access
50 static bool quiet =
false;
60 static bool verbose =
false;
70 static std::shared_ptr<Messenger> messenger(std::make_shared<ConsoleMessenger>());
140 #if defined(_MSC_VER)
143 res = _mkdir(winname.
CStr());
165 return access(lname.
CStr(), mode) == 0 ?
true :
false;
180 ok =
remove(lname.
CStr()) == 0;
215 struct dirent* diren=readdir(d);
219 if((!strcmp(diren->
d_name,
"."))||(!strcmp(diren->
d_name,
"..")))
225 snprintf(fname,1024,
"%s/%s", lname.
CStr(), diren->
d_name);
227 tempdir = opendir(fname);
230 closedir(tempdir); tempdir =
nullptr;
236 if(
remove(fname) !=0)
245 ret = _rmdir(lname.
CStr());
247 ret =
remove(lname.
CStr());
275 s.open(locsrc.
CStr(), std::ios::binary);
278 d.open(locdst.
CStr(), std::ios::binary);
315 DIR* d = opendir(lname.
CStr());
320 struct dirent* diren=readdir(d);
324 if((!strcmp(diren->
d_name,
"."))||(!strcmp(diren->
d_name,
"..")))
332 tempdir = opendir(fname.
CStr());
335 closedir(tempdir); tempdir =
nullptr;
336 directories.push_back(fname);
340 files.push_back(fname);
static void Warning(const String &msg)
Prints warning messages. Please use CRNWarning() macro instead.
static void ShieldRm(const Path &name)
Removes a file and protects it with mutex.
static void Debug(const String &msg)
Prints debug messages. Please use CRNDebug() macro instead.
static std::shared_ptr< Messenger > & CurrentMessenger()
Delegate that will print the messages.
static void Copy(const Path &src, const Path &dst)
Copies a file.
static void Mkdir(const Path &name)
Creates a directory.
static std::mutex & GetMutex(const Path &fname)
Gets the mutex associated to a file.
A UTF32 character string class.
static bool & IsQuiet()
If true, Debug, Warning, Verbose and Error don't print anything.
static bool & IsVerbose()
Controls whether CRNVerbose prints something or not.
static void Verbose(const String &msg)
Prints verbose messages. Please use CRNVerbose() macro instead.
const char * CStr() const noexcept
Conversion to UTF8 cstring.
A convenience class for file paths.
Path & ToWindows()
Converts the path to Windows format.
static void Error(const String &msg)
Prints error messages. Please use CRNError() macro instead.
static void Rmdir(const Path &name)
Recursively removes a directory.
static void ShieldCopy(const Path &src, const Path &dst)
Copies a file and protects source and destination with mutex.
Path & ToLocal()
Converts the path to the local format.
static void Rm(const Path &name)
Removes a file.
static bool Access(const Path &name, int mode)
Checks rights on a file.
A character string class.
Directory(const Path &path)
Constructor.
#define AtScopeExit(functor)
Executes a functor at the end of the scope.
Invalid argument error (e.g.: nullptr pointer)