Hotfix: Changed pacman database filename && Added missing logic for compressed directory

This commit is contained in:
ProfessionalUwU 2023-01-14 04:49:39 +01:00
parent eb2b1edf29
commit e07cdcfeb0
2 changed files with 6 additions and 4 deletions

View File

@ -12,7 +12,7 @@
string result3 = Update.copyEverthingAfterUpdateToBackupLocation();
Console.WriteLine(result3);
bool result4 = Update.zipAllContentInBackupLocation("after-backup.zip");
bool result4 = Update.zipAllContentInBackupLocation("post-backup.zip");
if (result4) {
Console.WriteLine(result4);
} else {

View File

@ -111,7 +111,9 @@ public class Update {
public static bool zipAllContentInBackupLocation(string finalZipName) {
string targetPath = getHomePath() + "/backup/compressed/";
Directory.CreateDirectory(targetPath);
if (!Directory.Exists(targetPath)) {
Directory.CreateDirectory(targetPath);
}
string sourcePath = getHomePath() + "/backup/uncompressed/"; // Moved to /tmp
string targetZip = getHomePath() + "/backup/compressed/" + finalZipName;
@ -152,12 +154,12 @@ public class Update {
public static bool zipPacmanDatabase() {
string pacmanDatabaseLocation = "/var/lib/pacman/local/";
string pacmanDatabaseZip = getHomePath() + "/backup/compressed/pacman_database.zip";
string pacmanDatabaseZip = getHomePath() + "/backup/compressed/pacman-database.zip";
if (!Directory.Exists("/tmp/backup/")) {
Directory.CreateDirectory("/tmp/backup/");
}
string newPacmanDatabaseZip = "/tmp/backup/pacman_database.zip";
string newPacmanDatabaseZip = "/tmp/backup/pacman-database.zip";
File.Delete(newPacmanDatabaseZip); // Delete residual Pacman Database in tmp
ZipFile.CreateFromDirectory(pacmanDatabaseLocation, newPacmanDatabaseZip);