Skip to content

Crash fix: Change settings directory to LocalApplicationData#312

Open
Rainyan wants to merge 1 commit intoRawAccelOfficial:masterfrom
Rainyan:SettingsPath
Open

Crash fix: Change settings directory to LocalApplicationData#312
Rainyan wants to merge 1 commit intoRawAccelOfficial:masterfrom
Rainyan:SettingsPath

Conversation

@Rainyan
Copy link

@Rainyan Rainyan commented Oct 30, 2025

Fix #284

This PR changes the rawaccel grapher app settings directory from Environment.CurrentDirectory (the CWD) to Environment.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:

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 "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?

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.
@Rainyan
Copy link
Author

Rainyan commented Oct 30, 2025

Looks like #230 is somewhat related.

@Rainyan Rainyan changed the title Change settings directory to LocalApplicationData Crash fix: Change settings directory to LocalApplicationData Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

raw accel isnt opening

1 participant