intag
intag copied to clipboard
Access denied on file write
System.UnauthorizedAccessException: Access to the path 'C:\DEV\uMMORPG2D\Desktop.ini' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
at System.IO.File.WriteAllText(String path, String contents, Encoding encoding)
at intag.FileUtils.AssignTagsToFolder(String folder, HashSet`1 tags) in C:\DEV\intag\intag\FileUtils.cs:line 58
at intag.FileUtils.AssignTags(Dictionary`2 objectTags) in C:\DEV\intag\intag\FileUtils.cs:line 29
at intag.MainForm.FormDeactivate(Object sender, EventArgs e) in C:\DEV\intag\intag\intag_form.cs:line 183
at System.Windows.Forms.Form.OnDeactivate(EventArgs e)
at System.Windows.Forms.Form.set_Active(Boolean value)
at System.Windows.Forms.Form.WmActivate(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I know you've probably moved on, but incase youre still looking for a solution, it is 100% a windows permissions problem. I can help you if you like, it's fairly straightforward.
All of these steps are performed within the (File > Right click > Properties > Security tab)
-
Edit > Add > Object name: "Users" (no quotes) > OK > Tick allow for "Full Control" > Apply > OK
-
Advanced > Owner > Change > "Users" (no quotes) > Tick 'Replace owner on subcontainers & objects' > Apply > OK
-
Advanced > Add > Select principal > "Users" (no quotes)" > Apply > OK > Full control > Add files & subdirectories > Allow > OK
Presto! Now, all files in said folder will have complete write & read access.
I came across this solution whilst trying to figure out how to display xmp-dc metadata (photo & video tags) within File explorer.
NOTE: If the file/folder already has tons of duplicate Principal entries (under Security > Advanced) - it will help to get a "fresh start" by pressing 'Disable inheritances' on each Principal, and then finally ticking 'Replace all child objects permissions with ...' > OK. (I forget, but I THINK you may need to re-grant yourself Full permissions real quick after replacing all child permissions)
Hey! Really appreciate your effort highlighting this. Yeah, that fixes the root of the problem. The issue, however, was created when I noticed that app crashed, instead of (at least) ignoring the problem.
I did not quite move on, but working on something else, so I just left issues unresolved, so that people can show interest in resolving specific problems within the app. If enough people bring the problem up, I'll spend more time resolving it.