Skip to content

Commit 841c963

Browse files
committed
cleanup and package logging stuff
1 parent f7bfce6 commit 841c963

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

ff-utils-winforms/IO/PackageBuild.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public static async Task Run (string ver)
3131
string archivePath1 = Path.Combine(dir, $"Nmkoder{ver}.7z");
3232
string archivePath2 = Path.Combine(dir, $"Nmkoder{ver}-NoOCR.7z");
3333

34-
Process p1 = Process.Start(path7z, $"a {archivePath1.Wrap()} -m0=flzma2 -mx9 {copyDir.Wrap()}");
34+
string args = $"a {archivePath1.Wrap()} -m0=flzma2 -mx9 {copyDir.Wrap()}";
35+
Logger.Log($"\"{path7z}\" {args}");
36+
Process p1 = Process.Start(path7z, args);
3537
while (!p1.HasExited) await Task.Delay(100);
3638
IoUtils.TryDeleteIfExists(Path.Combine(copyDir, "bin", "SE"));
3739
Process.Start(path7z, $"a {archivePath2.Wrap()} -m0=flzma2 -mx9 {copyDir.Wrap()}");

ff-utils-winforms/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ public static void Cleanup()
5151
{
5252
string[] split = dir.Name.Split('-');
5353
int daysOld = (DateTime.Now - new DateTime(split[0].GetInt(), split[1].GetInt(), split[2].GetInt())).Days;
54+
int fileCount = dir.GetFiles("*", SearchOption.AllDirectories).Length;
5455

55-
if (daysOld > keepLogsDays || dir.GetFiles("*", SearchOption.AllDirectories).Length < 1) // keep logs for 4 days
56+
if (daysOld > keepLogsDays || fileCount < 1) // keep logs for 4 days
5657
{
57-
Logger.Log($"Cleanup: Log folder {dir.Name} is {daysOld} days old - Will Delete", true);
58+
Logger.Log($"Cleanup: Log folder {dir.Name} is {daysOld} days old and has {fileCount} files - Will Delete", true);
5859
IoUtils.TryDeleteIfExists(dir.FullName);
5960
}
6061
}
@@ -65,10 +66,11 @@ public static void Cleanup()
6566
{
6667
string[] split = dir.Name.Split('-');
6768
int daysOld = (DateTime.Now - new DateTime(split[0].GetInt(), split[1].GetInt(), split[2].GetInt())).Days;
69+
int fileCount = dir.GetFiles("*", SearchOption.AllDirectories).Length;
6870

69-
if (daysOld > keepSessionDataDays || dir.GetFiles("*", SearchOption.AllDirectories).Length < 1) // keep temp files for 2 days
71+
if (daysOld > keepSessionDataDays || fileCount < 1) // keep temp files for 2 days
7072
{
71-
Logger.Log($"Cleanup: Session folder {dir.Name} is {daysOld} days old - Will Delete", true);
73+
Logger.Log($"Cleanup: Session folder {dir.Name} is {daysOld} days old and has {fileCount} files - Will Delete", true);
7274
IoUtils.TryDeleteIfExists(dir.FullName);
7375
}
7476
}

0 commit comments

Comments
 (0)