'Generic Commit'
This commit is contained in:
parent
cd07649040
commit
b9a7cc718d
@ -626,8 +626,9 @@ int clean_tool(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
// Step 3: Clean up ~/.local/bin/getpkg/ - remove dangling symlinks
|
||||
// Step 3: Clean up ~/.local/bin/getpkg/ - remove dangling symlinks and non-symlinks
|
||||
int danglingSymlinksRemoved = 0;
|
||||
int nonSymlinksRemoved = 0;
|
||||
if (std::filesystem::exists(binDir)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(binDir)) {
|
||||
if (entry.is_symlink()) {
|
||||
@ -644,6 +645,15 @@ int clean_tool(int argc, char* argv[]) {
|
||||
std::filesystem::remove(entry.path());
|
||||
danglingSymlinksRemoved++;
|
||||
}
|
||||
} else {
|
||||
// Remove anything that's not a symlink (directories, regular files, etc.)
|
||||
std::cout << "Removing non-symlink: " << entry.path().filename() << std::endl;
|
||||
if (entry.is_directory()) {
|
||||
std::filesystem::remove_all(entry.path());
|
||||
} else {
|
||||
std::filesystem::remove(entry.path());
|
||||
}
|
||||
nonSymlinksRemoved++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -722,6 +732,7 @@ int clean_tool(int argc, char* argv[]) {
|
||||
std::cout << "\nCleanup complete:" << std::endl;
|
||||
std::cout << " - Removed " << configFilesRemoved << " orphaned config files" << std::endl;
|
||||
std::cout << " - Removed " << danglingSymlinksRemoved << " dangling symlinks" << std::endl;
|
||||
std::cout << " - Removed " << nonSymlinksRemoved << " non-symlinks from ~/.local/bin/getpkg" << std::endl;
|
||||
std::cout << " - Cleaned " << autocompleteCleaned << " autocomplete entries" << std::endl;
|
||||
std::cout << " - Removed " << emptyDirsRemoved << " empty directories" << std::endl;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user