Updating can fail due to lack of permission
Describe the bug
I put the FanControl files in my C:\Program Files directory.
PS C:\Program Files\FanControl> .\Updater.exe
Downloading Fan Control v139...
Extracting archive...
Extract failed: System.UnauthorizedAccessException: Access to the path 'C:\Program Files\FanControl\Emoji.Wpf.dll' 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)
at Updater.Program.Extract(Stream zipStream, String extractDirectoryPath)
Mitigation:
Right click the affected file (Emoji.Wpf.dll) --> Properties --> Security tab --> Edit... -->
Allow "Full control" for ALL APPLICATION PACKAGES.
Then repeat with all files until the update succeeds. This was 5 files for me:
C:\Program Files\FanControl\Emoji.Wpf.dllC:\Program Files\FanControl\FanControl.Plugins.dllC:\Program Files\FanControl\FanControl.Plugins.dllC:\Program Files\FanControl\Typography.GlyphLayout.dllC:\Program Files\FanControl\Typography.OpenFont.dll
Is this a security/premssions faux pax? Probably. But it worked.
I have this issue on every update but it's because the app doesnt close fast enough so the file is still in use when the updater runs. What I do is click into the terminal window of the update to pause it (b/c windows console pauses the script when you focus into the console) then wait a few seconds. Works every time but seems like the updater script should make sure the app closes before continuing.
@giulianob just realized there wasn't a proper waiting mechanism in place. I will add that to the updater.
Pushed a new version of the updater.