mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Fixed a crashing bug when the server manager closes and is unable to find the backup location to save the config settings.
This commit is contained in:
parent
34582ca91b
commit
9d5dafaed6
7 changed files with 37 additions and 10 deletions
|
|
@ -47,18 +47,25 @@ namespace ServerManagerTool.Common.Utils
|
|||
// do nothing, just exit
|
||||
}
|
||||
|
||||
var filesToDelete = new DirectoryInfo(backupPath).GetFiles($"{settingsFileName}_*{settingsFileExt}").Where(f => f.LastWriteTimeUtc.AddDays(7) < DateTime.UtcNow).ToArray();
|
||||
foreach (var fileToDelete in filesToDelete)
|
||||
try
|
||||
{
|
||||
try
|
||||
var filesToDelete = new DirectoryInfo(backupPath).GetFiles($"{settingsFileName}_*{settingsFileExt}").Where(f => f.LastWriteTimeUtc.AddDays(7) < DateTime.UtcNow).ToArray();
|
||||
foreach (var fileToDelete in filesToDelete)
|
||||
{
|
||||
fileToDelete.Delete();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// do nothing, just exit
|
||||
try
|
||||
{
|
||||
fileToDelete.Delete();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// do nothing, just exit
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// do nothing, just exit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue