diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-09 16:32:00 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-09 16:32:00 -0400 |
commit | 9488d6482b03aa2227318f0028d10a44849367f6 (patch) | |
tree | dcb1795b083760855a8b6c7afc647f7bd864fdd5 | |
parent | 03e679d66cc7439b0218c95cbead925786e37e86 (diff) | |
download | SMAPI-9488d6482b03aa2227318f0028d10a44849367f6.tar.gz SMAPI-9488d6482b03aa2227318f0028d10a44849367f6.tar.bz2 SMAPI-9488d6482b03aa2227318f0028d10a44849367f6.zip |
fix some log files not deleted on startup
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | src/SMAPI/Constants.cs | 9 | ||||
-rw-r--r-- | src/SMAPI/Program.cs | 7 |
3 files changed, 10 insertions, 7 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index d14b7459..5b0dab4c 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,6 +4,7 @@ * Fixed custom festival maps always using spring tilesheets. * Fixed `player_add` command not recognising return scepter. * Fixed `player_add` command showing fish twice. + * Fixed some SMAPI logs not deleted when starting a new session. * For modders: * All enums in `config.json` are now serialised to string by default, since that's more user-friendly. Previously only certain predefined enums were serialised that way. Note that `config.json` files which already have integer enums will still be parsed fine. diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index a6cddbe4..07bb3e17 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -70,11 +70,14 @@ namespace StardewModdingAPI /// <summary>The file path for the SMAPI metadata file.</summary> internal static string ApiMetadataPath => Path.Combine(Constants.ExecutionPath, $"{typeof(Program).Assembly.GetName().Name}.metadata.json"); - /// <summary>The filename prefix for SMAPI log files.</summary> - internal static string LogNamePrefix { get; } = "SMAPI-latest"; + /// <summary>The filename prefix used for all SMAPI logs.</summary> + internal static string LogNamePrefix { get; } = "SMAPI-"; + + /// <summary>The filename for SMAPI's main log, excluding the <see cref="LogExtension"/>.</summary> + internal static string LogFilename { get; } = $"{Constants.LogNamePrefix}latest"; /// <summary>The filename extension for SMAPI log files.</summary> - internal static string LogNameExtension { get; } = "txt"; + internal static string LogExtension { get; } = "txt"; /// <summary>A copy of the log leading up to the previous fatal crash, if any.</summary> internal static string FatalCrashLog => Path.Combine(Constants.LogDir, "SMAPI-crash.txt"); diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 999aa23c..5d8b267f 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -435,7 +435,7 @@ namespace StardewModdingAPI ModFolderPath = Constants.ModPath, Mods = mods }; - this.Toolkit.JsonHelper.WriteJsonFile(Path.Combine(Constants.LogDir, $"{Constants.LogNamePrefix}.metadata-dump.json"), export); + this.Toolkit.JsonHelper.WriteJsonFile(Path.Combine(Constants.LogDir, $"{Constants.LogNamePrefix}metadata-dump.json"), export); } // check for updates @@ -1060,7 +1060,6 @@ namespace StardewModdingAPI yield return "uses the 'dynamic' keyword. This won't work on Linux/Mac."; if (mask.HasFlag(ModWarning.NoUpdateKeys)) yield return "has no update keys in its manifest. SMAPI won't show update alerts for this mod."; - } /// <summary>Load a mod's entry class.</summary> @@ -1257,7 +1256,7 @@ namespace StardewModdingAPI { // default path { - FileInfo defaultFile = new FileInfo(Path.Combine(Constants.LogDir, $"{Constants.LogNamePrefix}.{Constants.LogNameExtension}")); + FileInfo defaultFile = new FileInfo(Path.Combine(Constants.LogDir, $"{Constants.LogFilename}.{Constants.LogExtension}")); if (!defaultFile.Exists) return defaultFile.FullName; } @@ -1265,7 +1264,7 @@ namespace StardewModdingAPI // get first disambiguated path for (int i = 2; i < int.MaxValue; i++) { - FileInfo file = new FileInfo(Path.Combine(Constants.LogDir, $"{Constants.LogNamePrefix}.player-{i}.{Constants.LogNameExtension}")); + FileInfo file = new FileInfo(Path.Combine(Constants.LogDir, $"{Constants.LogFilename}.player-{i}.{Constants.LogExtension}")); if (!file.Exists) return file.FullName; } |