CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
571 stars 85 forks source link

TMPE.log "access denied" error when C:SL moved to different drive #292

Closed originalfoo closed 5 years ago

originalfoo commented 5 years ago

If user moves their steamapps folder to another drive (or their entire C: drive for that matter) something in the game isn't getting updated properly and exceptions occur:

https://steamcommunity.com/app/255710/discussions/0/1678063648163403458/

A Mod caused an error [System.Exception]

Details:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UnauthorizedAccessException: Access to the path "F:\Program Files1 (x86)\Steam\steamapps\common\Cities_Skylines\Cities_Data\TMPE.log" is denied.
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in <filename unknown>:0 
at System.IO.StreamWriter..ctor (System.String path, Boolean append) [0x00000] in <filename unknown>:0 
at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool)
at System.IO.File.AppendText (System.String path) [0x00000] in <filename unknown>:0 
at CSUtil.Commons.Log.LogToFile (System.String log, LogLevel level) [0x00000] in <filename unknown>:0 
at CSUtil.Commons.Log.Info (System.String s) [0x00000] in <filename unknown>:0 
at TrafficManager.TrafficManagerMod.OnEnabled () [0x00000] in <filename unknown>:0 
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception
A Mod caused an error [System.Exception]

Details:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for TrafficManager.State.GlobalConfig ---> System.UnauthorizedAccessException: Access to the path "F:\Program Files1 (x86)\Steam\steamapps\common\Cities_Skylines\Cities_Data\TMPE.log" is denied.
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in <filename unknown>:0 
at System.IO.StreamWriter..ctor (System.String path, Boolean append) [0x00000] in <filename unknown>:0 
at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool)
at System.IO.File.AppendText (System.String path) [0x00000] in <filename unknown>:0 
at CSUtil.Commons.Log.LogToFile (System.String log, LogLevel level) [0x00000] in <filename unknown>:0 
at CSUtil.Commons.Log.Warning (System.String s) [0x00000] in <filename unknown>:0 
at TrafficManager.State.GlobalConfig.Load (System.DateTime
FireController1847 commented 5 years ago

@aubergine10 Have you manually moved over your steamapps folder without using Steam's Library function?

I only ask this because I previously moved my game to the D:\ drive once upon a time and I developed like that; never had an issue with TMPE.log not having permission to be written to.

EDIT: My apologies, I had missed the discussion link. Looking more into it, it appears he has moved windows by... literally moving and dragging the folders over. Nobody should ever do that, ever. If he wanted to install on a different drive, he should have changed the drive while he was installing Windows. En quote, "I got many problems with administrator rights with steam games." Clearly this is not the only time he's had an issue like this.

Your solution of reinstalling the game using the Steam Library function PROPERLY should have fixed it, HOWEVER that being said it is likely it wont due to folder permissions being screwed up due to him... moving... windows... manually. Don't do that. Don't ever do that. It's stupid.

originalfoo commented 5 years ago

I run everything on Drive C: (1TB SSD). The error report above was from a user on Steam (discussion link in OP).

FireController1847 commented 5 years ago

@aubergine10 My apologies. The issue for this is not a TM:PE issue and is in fact a user-error issue. I'm closing this issue until I can find some reason this is caused by TM:PE and not him moving everything manually. I have repsponded to his discussion and hopefully he'll be able to get it resolved.