mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-31 04:25:17 -04:00
Make use of "ensure_directory" function (#1765)
This commit is contained in:
parent
409242507c
commit
58307aee9c
8 changed files with 10 additions and 24 deletions
|
@ -53,7 +53,6 @@ class UnTar {
|
|||
}
|
||||
|
||||
static bool create_dir(char* pathname) {
|
||||
char* p;
|
||||
std::filesystem::filesystem_error r;
|
||||
|
||||
if (!isValidName(pathname)) return false;
|
||||
|
@ -65,18 +64,7 @@ class UnTar {
|
|||
std::string dirnameStr = u'/' + pathname;
|
||||
std::filesystem::path dirname = dirnameStr;
|
||||
|
||||
r = make_new_directory(dirname);
|
||||
|
||||
if (!r.ok()) {
|
||||
/* On failure, try creating parent directory. */
|
||||
p = strrchr(pathname, '/');
|
||||
if (p != NULL) {
|
||||
*p = '\0';
|
||||
create_dir(pathname);
|
||||
*p = '/';
|
||||
r = make_new_directory(dirname);
|
||||
}
|
||||
}
|
||||
r = ensure_directory(dirname);
|
||||
return (r.ok());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue