exelix11 / SysDVR

Stream switch games to your PC via USB or network
GNU General Public License v2.0
1.52k stars 88 forks source link

Flatpak version crashes when saving settings #255

Closed Parnassius closed 10 months ago

Parnassius commented 10 months ago

Describe the bug Flatpak version crashes when saving settings

To Reproduce

Expected behavior Settings should get saved

Setup information

Additional context This is the error log that shows up as soon as I try to save the settings:

System.IO.IOException: Read-only file system : '/app/bin/options.json'
   at Interop.ThrowExceptionForIoErrno(Interop.ErrorInfo, String, Boolean) + 0x19
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String, Interop.Sys.OpenFlags, Int32, Boolean, Boolean&, Func`4) + 0x13f
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String, FileMode, FileAccess, FileShare, FileOptions, Int64, UnixFileMode, Int64&, UnixFileMode&, Boolean, Boolean&, Func`4) + 0x11c
   at System.IO.File.OpenHandle(String, FileMode, FileAccess, FileShare, FileOptions, Int64) + 0x96
   at System.IO.File.WriteToFile(String, FileMode, String, Encoding) + 0x81
   at SysDVR.Client.GUI.OptionsView.Draw() + 0x124
   at SysDVR.Client.ClientApp.EntryPoint() + 0x2e2
   at SysDVR.Client.Program.RunApp(String[]) + 0x2b8

The issue seems to originate from the value of Resources.SettingsStorePath, which is set to the folder that contains the SysDVR-Client executable. On Flatpak this is /app/bin, which is not user-writable.

A possible fix could be setting that variable to a subfolder of $XDG_CONFIG_HOME (usually ~/.var/app/com.github.exelix11.sysdvr/config/ when running in a Flatpak), adding a check in SystemUtil.StoreSettingsString to make sure the folder exists before saving.

Sadly I know basically nothing about dotnet, so I'm unable to create a pull request to fix this.

Thank you

exelix11 commented 10 months ago

It's fine, thanks for providing the insight needed to fix the issue so i can get to work on it right away.

exelix11 commented 10 months ago

The issue seems fixed on my end, can you try latest flatpak from github actions https://github.com/exelix11/SysDVR/actions/runs/7426921602/artifacts/1150957073 ?

Parnassius commented 10 months ago

The latest commit fixed the issue for me as well, thank you!

exelix11 commented 10 months ago

I also updated the release, if anyone else is affected just redownload the 6.0 flatpak. The fixed version shows build id e18a704