From 7de0915961320f0bb05e8b24631fb98447b09a41 Mon Sep 17 00:00:00 2001 From: Pino Date: Sat, 27 Apr 2019 15:47:41 +0200 Subject: [PATCH] Add SAVE_LOG_IN_TEMP_INSTEAD_OF_PLUGIN_DIR preprocessor definition and code, disabled by default in order to remain backward compatible for now... # legacy-bckcompat-isofunc-addonly-preproc-toggle-hotfix # prepared-hotfix-toggle --- CodeStats/Logger.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CodeStats/Logger.cs b/CodeStats/Logger.cs index 507f90c..d6ebc07 100644 --- a/CodeStats/Logger.cs +++ b/CodeStats/Logger.cs @@ -1,3 +1,5 @@ +// #define SAVE_LOG_IN_TEMP_INSTEAD_OF_PLUGIN_DIR + using Kbg.NppPluginNET.PluginInfrastructure; using System; using System.IO; @@ -66,10 +68,14 @@ private static StreamWriter Setup() //var configDir = Dependencies.AppDataDirectory; if (String.IsNullOrWhiteSpace(configDir)) { +#if SAVE_LOG_IN_TEMP_INSTEAD_OF_PLUGIN_DIR + configDir = System.Environment.GetEnvironmentVariable("TEMP"); +#else // BACKWARD COMPATIBLE // get path of plugin configuration StringBuilder sbIniFilePath = new StringBuilder(Win32.MAX_PATH); Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath); configDir = sbIniFilePath.ToString(); +#endif } if (string.IsNullOrWhiteSpace(configDir)) return null; @@ -83,10 +89,14 @@ public static void Delete() //var configDir = Dependencies.AppDataDirectory; if (String.IsNullOrWhiteSpace(configDir)) { +#if SAVE_LOG_IN_TEMP_INSTEAD_OF_PLUGIN_DIR + configDir = System.Environment.GetEnvironmentVariable("TEMP"); +#else // BACKWARD COMPATIBLE // get path of plugin configuration StringBuilder sbIniFilePath = new StringBuilder(Win32.MAX_PATH); Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath); configDir = sbIniFilePath.ToString(); +#endif } if (string.IsNullOrWhiteSpace(configDir)) return;