Fix OpenDirectory access denied error for OneDrive paths and double backslashes #45
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.
Description
Fixes #[issue_number] - Resolves the "Access is denied" error when clicking the "Open configuration or data files button" in the application settings.
Problem
The application was crashing with a
Win32Exception (5): Access is deniedwhen users attempted to open configuration or backup directories, particularly affecting:C:\Users\...\ContextMenuManager\\Config)The error occurred because the
OpenDirectorymethod was directly using the directory path as the process filename, which Windows doesn't handle reliably across all path types and configurations.Solution
Modified the
ExternalProgram.OpenDirectory()method inBluePointLilac.Methods/ExternalProgram.csto explicitly invokeexplorer.exewith the directory path as a properly quoted argument:Before:
After:
Benefits
Testing
This fix affects all "Open folder" operations in the application:
The change ensures these buttons work correctly regardless of the installation path or Windows configuration.
Original prompt
This section details on the original issue you should resolve
<issue_title>[Bug]: Open Configuration Folder Issue</issue_title>
<issue_description>### Checklist
Windows
Windows 11
Version
3.5.1.0
Steps to Reproduce
Crash logs
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ComponentModel.Win32Exception (5): An error occurred trying to start process 'C:\Users\11602\OneDrive\Tools\ContextMenuManager\Config' with working directory 'C:\Users\11602\OneDrive\Tools\ContextMenuManager'. Access is denied.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at BluePointLilac.Methods.ExternalProgram.OpenDirectory(String dirPath)
at ContextMenuManager.Controls.AppSettingBox.<>c.<.ctor>b__0_1(Object sender, MouseEventArgs e)
at BluePointLilac.Controls.PictureButton.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)
************** Loaded Assemblies **************
System.Private.CoreLib
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Private.CoreLib.dll
ContextMenuManager
Assembly Version: 3.5.1.0
Location:
System.Runtime
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Runtime.dll
System.Windows.Forms
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\9.0.9\System.Windows.Forms.dll
System.ComponentModel.Primitives
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.ComponentModel.Primitives.dll
System.Windows.Forms.Primitives
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\9.0.9\System.Windows.Forms.Primitives.dll
System.Private.Windows.Core
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\9.0.9\System.Private.Windows.Core.dll
System.Drawing.Primitives
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Drawing.Primitives.dll
System.Collections.Specialized
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Collections.Specialized.dll
Microsoft.Win32.Registry
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\Microsoft.Win32.Registry.dll
System.Runtime.InteropServices
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Runtime.InteropServices.dll
System.Threading
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Threading.dll
System.Collections
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Collections.dll
System.Diagnostics.Process
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Diagnostics.Process.dll
System.Memory
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Memory.dll
Microsoft.Win32.Primitives
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\Microsoft.Win32.Primitives.dll
System.Net.NameResolution
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Net.NameResolution.dll
System.Diagnostics.Tracing
Assembly Version: 9.0.0.0
Location: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.9\System.Diagnostics.Tracing.dll
-----------------------------...
Fixes #44
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.