Crash fix: Change settings directory to LocalApplicationData#312
Open
Rainyan wants to merge 1 commit intoRawAccelOfficial:masterfrom
Open
Crash fix: Change settings directory to LocalApplicationData#312Rainyan wants to merge 1 commit intoRawAccelOfficial:masterfrom
Rainyan wants to merge 1 commit intoRawAccelOfficial:masterfrom
Conversation
Fix RawAccelOfficial#284 This commit changes the rawaccel grapher app settings directory from Environment.CurrentDirectory (the CWD) to Environment.SpecialFolder.LocalApplicationData (%LOCALAPPDATA%\rawaccel). This fixes the problem where if the grapher was launched from a CWD where the launching user didn't have write privileges, the app would crash. Most prominently, this would occur when attempting to launch the grapher app via the Windows key Start Menu, where CWD is set as "C:\Windows\System32", which typically A) would be write protected, and B) most likely is not where the user intended to store their rawaccel configs and themes. An example crash stack trace when launcing from the Start Menu: ``` System.UnauthorizedAccessException HResult=0x80070005 Message=Access to the path 'C:\WINDOWS\system32\themes' is denied. Source=<Cannot evaluate the exception source> StackTrace: KERNELBASE.dll!00007ff9e0da804a() Unknown [External Code] > mscorlib.dll!System.IO.__Error.WinIOError(int errorCode, string maybeFullPath) Line 139 C# mscorlib.dll!System.IO.Directory.InternalCreateDirectory(string fullPath, string path, object dirSecurityObj, bool checkHost) Line 263 C# mscorlib.dll!System.IO.Directory.InternalCreateDirectoryHelper(string path, bool checkHost) Line 93 C# rawaccel.exe!grapher.Models.Theming.IO.ThemeFileOperations.LoadThemes() Line 20 C# rawaccel.exe!grapher.RawAcceleration.RawAcceleration() Line 457 C# rawaccel.exe!grapher.Program.Main() Line 26 C# [External Code] ``` The unfortunate side-effect of this commit is "breakage" of all existing user settings, unless the user manually moves them to the new location.
Author
|
Looks like #230 is somewhat related. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #284
This PR changes the rawaccel grapher app settings directory from
Environment.CurrentDirectory(the CWD) toEnvironment.SpecialFolder.LocalApplicationData(the%LOCALAPPDATA%\rawaccel).This fixes the problem where if the grapher GUI was launched from a CWD where the launching user didn't have write privileges, the app would crash. Most prominently, this would occur when attempting to launch the grapher app via the Windows key Start Menu or a Windows Explorer search result page (repro steps here), where CWD is set as
C:\WINDOWS\system32, which typically A) would be write protected, and B) most likely is not where the user intended to store their rawaccel configs and themes.An example crash stack trace of this bug is shown below:
The unfortunate side-effect of this commit is "loss" of all existing user settings, unless the user manually moves them to the new location. But it's probably worth it, to fix the bug?