Skip to content

Commit

Permalink
Added Backup Database File
Browse files Browse the repository at this point in the history
Added Get Backup Database File path, so that we can properly backup the database / restore the database, incase of corruption.
  • Loading branch information
eumario committed Jul 7, 2024
1 parent e1208e7 commit d232cf8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion libs/util/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,25 @@ public static string GetDatabaseFile()
{
var path = GetUserFolder("central_store.json");
if (!OS.GetExecutablePath().GetFile().StartsWith("GodotManager"))
{
path = GetUserFolder("central_store_devel.json");
if (OS.GetExecutablePath().GetFile().StartsWith("GodotManager"))
{
if (SFile.Exists(OS.GetExecutablePath().GetBaseDir().Join("._sc_")) ||
SFile.Exists(OS.GetExecutablePath().GetBaseDir().Join("_sc_")))
{
if (!Dir.Exists(path.GetBaseDir()))
Dir.CreateDirectory(path.GetBaseDir());
}
}

return path;
}

public static string GetBackupDatabaseFile()
{
var path = GetUserFolder("central_store.bak");
if (!OS.GetExecutablePath().GetFile().StartsWith("GodotManager"))
path = GetUserFolder("central_store_devel.bak");
if (OS.GetExecutablePath().GetFile().StartsWith("GodotManager"))
{
if (SFile.Exists(OS.GetExecutablePath().GetBaseDir().Join("._sc_")) ||
Expand Down

0 comments on commit d232cf8

Please # to comment.