Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SAVE_LOG_IN_TEMP_INSTEAD_OF_PLUGIN_DIR preprocessor definition ... #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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