mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2024-11-17 02:35:57 +01:00
util: prompt before nuking out directory
This commit is contained in:
parent
a5cfddb46f
commit
2e42262ac5
1 changed files with 18 additions and 2 deletions
|
@ -38,6 +38,22 @@ static std::string removeBeginEndSpacesTabs(std::string str) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool promptForDeletion(const std::string& path) {
|
||||||
|
std::cout << "About to delete (recursively) " << path << ", are you sure? [Y/n]\n";
|
||||||
|
std::string result;
|
||||||
|
std::cin >> result;
|
||||||
|
|
||||||
|
if (result != "Y" && result != "Y\n" && result != "y\n" && result != "y") {
|
||||||
|
std::cout << "Abort.\n";
|
||||||
|
exit(1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::filesystem::remove_all(path);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<SCursorTheme> currentTheme;
|
std::unique_ptr<SCursorTheme> currentTheme;
|
||||||
|
|
||||||
static Hyprlang::CParseResult parseDefineSize(const char* C, const char* V) {
|
static Hyprlang::CParseResult parseDefineSize(const char* C, const char* V) {
|
||||||
|
@ -181,7 +197,7 @@ static std::optional<std::string> createCursorThemeFromPath(const std::string& p
|
||||||
std::filesystem::create_directory(out);
|
std::filesystem::create_directory(out);
|
||||||
else {
|
else {
|
||||||
// clear the entire thing, avoid melting themes together
|
// clear the entire thing, avoid melting themes together
|
||||||
std::filesystem::remove_all(out);
|
promptForDeletion(out);
|
||||||
std::filesystem::create_directory(out);
|
std::filesystem::create_directory(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +281,7 @@ static std::optional<std::string> extractXTheme(const std::string& xpath, const
|
||||||
std::filesystem::create_directory(out);
|
std::filesystem::create_directory(out);
|
||||||
else {
|
else {
|
||||||
// clear the entire thing, avoid melting themes together
|
// clear the entire thing, avoid melting themes together
|
||||||
std::filesystem::remove_all(out);
|
promptForDeletion(out);
|
||||||
std::filesystem::create_directory(out);
|
std::filesystem::create_directory(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue