utils/file: rework remove_directory, add test

Make remove_directory not much less ugly, but at least more robust, e.g., when
the "rm" binary is not at /bin/rm

Add unit test
This commit is contained in:
Dirk-Jan C. Binnema
2025-11-19 22:25:25 +02:00
committed by Seth Ladygo
parent 95843d4e8a
commit d258c77661
2 changed files with 45 additions and 20 deletions

View File

@ -61,7 +61,6 @@ std::string canonicalize_filename(const std::string& path, const std::string& re
*/
Result<std::string> expand_path(const std::string& str);
/**
* Get the basename for path, i.e. without leading directory component,
* @see g_path_get_basename
@ -72,7 +71,6 @@ Result<std::string> expand_path(const std::string& str);
*/
std::string basename(const std::string& path);
/**
* Get the dirname for path, i.e. without leading directory component,
* @see g_path_get_dirname
@ -83,7 +81,6 @@ std::string basename(const std::string& path);
*/
std::string dirname(const std::string& path);
/*
* for OSs without support for direntry->d_type, like Solaris
*/
@ -122,7 +119,6 @@ enum {
*/
uint8_t determine_dtype(const std::string& path, bool use_lstat=false);
/**
* Well-known runtime paths
*
@ -190,7 +186,6 @@ std::string join_paths(S&& s, Args...args) {
return path;
}
/**
* Like g_cancellable_new(), but automatically cancels itself
* after timeout