Implement Trash option, update fslib for bug fix.

This commit is contained in:
J-D-K
2025-08-22 09:07:33 -04:00
parent 3b52b82e38
commit bb26eb98ec
5 changed files with 37 additions and 9 deletions

View File

@@ -172,11 +172,11 @@ bool JKSV::create_directories()
const bool workDirCreated = needsWorkDir && fslib::create_directories_recursively(workDir);
if (needsWorkDir && !workDirCreated) { return false; }
// SVI folder.
const fslib::Path sviDir = workDir / "svi";
const bool needsSviDir = !fslib::directory_exists(sviDir);
const bool sviDirCreated = needsSviDir && fslib::create_directory(sviDir);
if (needsSviDir && !sviDirCreated) { return false; }
// Trash folder. This can fail without being fatal.
const fslib::Path trashDir{workDir / "_TRASH_"};
const bool trashEnabled = config::get_by_key(config::keys::ENABLE_TRASH_BIN);
const bool needsTash = trashEnabled && !fslib::directory_exists(trashDir);
if (needsTash) { error::fslib(fslib::create_directory(trashDir)); }
return true;
}