Basic cleanup options added

This commit is contained in:
2020-12-29 20:09:18 +01:00
parent cb3db37d8c
commit 863cbb6d9b
6 changed files with 123 additions and 13 deletions
+18
View File
@@ -290,4 +290,22 @@ class optimizer
return $name;
}
public static function cleanup_dir(string $dir, bool $recursion = false) : void
{
$dir = rtrim(str_replace("\\", "/", $dir), "/");
$glob = glob(utils::globsafe($dir) . "/*");
foreach ($glob as $file)
{
if (is_dir($file) && $recursion)
{
self::cleanup_dir($file, true);
@rmdir($file);
}
else
{
unlink($file);
}
}
}
}
+5
View File
@@ -45,4 +45,9 @@ class optimizer_settings
{
return $this->osu_path;
}
public function get_settings_path() : string
{
return $this->path;
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ class osu_library
};
}
$glob = glob($library_folder . "/*", GLOB_ONLYDIR);
$glob = glob(utils::globsafe($library_folder) . "/*", GLOB_ONLYDIR);
natsort($glob); // i like wasting your processing power
foreach($glob as $folder)