Closed deskobj closed 2 years ago
SAVE_LOG_IN_TEMP_INSTEAD_OF_PLUGIN_DIR
Do not save the log file in the Notepad++'s AppData directory, use the TEMP directory instead.
I have implemented a fix for the problem reported at:
p0358/notepadpp-CodeStats "Errors popping as I type in files that have extensions that are not supported (eg. .cmd, .au3)" https://github.com/p0358/notepadpp-CodeStats/issues/8
Changesets:
and the Binary DLLs:
(tested with Notepad++ 7.6.6)
Kind regards,
P.
@deskobj Hmm, I seem to have problems reproducing this issue in current public plugin version. Of course, the "Key = "x" is not found." spam in log occurs. But the only way I can reproduce is having the log file opened in the same Notepad++ instance in monitoring (aka tail -f) mode. Perhaps you had some software that was monitoring the file and interfering? Anyways, my proposed fix for unwanted errors popping up is to limit log error message boxes to up to 1 per session, so that further errors will be ignored in order not to interrupt user work
Hi, yes, sorry it's me, I didn't pay attention and logged the ticket with my other account.
Great idea to having used the monitoring mode to reproduce the problem (y) ;-)
Yes, indeed, the file is being monitored by Dropbox because I am using Notepad++ as a portable application.
Even without the errors related to the unrecognised extensions (au3, cmd), there were still too many open-write-close operations performed on the log file and I kept getting dialog boxes in my faces (although slightly less often).
Changing the location of the log file to TEMP fixed the problem.
By the way, this is why Notepad++ has "Settings on cloud" feature (Settings->Preferences->Cloud). It also doesn't safe session (opened files, their positions), so it's better to use across multiple computers. Its disadvantage though is that it doesn't save plugins or their config. Thus moving logs to temp folder might be a good solution, I will consider it and probably implement
Yes indeed, I noticed the "Settings on cloud" and tried it a couple months ago, but I found that I was missing some settings.
And actually my trick of making AppData\Notepad++ a junction to a synchronized location wasn't great either because it didn't contain my plugins which were stored in ProgramFiles (although it did contain the plugins configuration, but not the binaries).
I guess I could have fixed this by making use of the allowAppDataPlugins.xml and moving all my plugins to the AppData directory, but this started to feel like becoming overly complicated (and not any safer/secure anyway, at that point).
So earlier this month, I actually uninstalled Notepad++, and I am using the portable package instead now (so everything runs from the same directory, from Dropbox-or-alike).
This should now be fixed/mitigated in v1.1.0 due to following changes:
Installed the Code::Stats Plugin for Notepad++ a few hours ago, and run into a pretty serious issue; the kind of issue that will make me uninstall CodeStats ASAP.
What is the bug about: As soon as I start typing in files which have an extension that is not registered I am getting error.
The bugfix should :
Followed by:
Typical files which trigger the error are ".cmd" and ".au3".
Despite the fact the error says the log file could not be written, we can still see some output in there. (And the output seem up-to-date.)
Or when editing a "*.cmd" command file
What those ".cmd" and ".au3" files seem to have in common is that they are not registered in the Plugin DLL, which, if you open it, contains the following static string : (C:\Program Files\Notepad++\plugins\CodeStats\CodeStats.dll)
I don't think the log file is used by another process. The only thing that is specific with my setup is that my directory "
%AppData%\Roaming\Notepad++\plugins\Config
" is actually a hardlink to another location (a Dropbox directory), and for some reason this is maybe making harder for the plugin to write in it, which then causes the exception and finally makes Notepad++ display error message dialogs as I type.Also, note that I don't have this problem if I write in more common files, such as a .txt or a .cs, so it's a cascading effect, ie. there are 2 problems here : 1/ log file being filled with the "
Key = "EXT" is not found.
" and 2/ actually sometimes failing to write there and causing the errors to pop and interrupt editing ever couple of keystrokes.