Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CodeStats/Logger.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// #define SAVE_LOG_IN_TEMP_INSTEAD_OF_PLUGIN_DIR

using Kbg.NppPluginNET.PluginInfrastructure;
using System;
using System.IO;
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down