Founntain / osuplayer

Official osu!player repository. osu!player is a music player for the game osu! made by Dean 'peppy' Herbert. Written in the cross-platform framework AvaloniaUI
MIT License
62 stars 6 forks source link

[REQUEST] Store data in ApplicationData directory #276

Open Anti-Apple4life opened 4 months ago

Anti-Apple4life commented 4 months ago

Is your feature request related to a problem? Please describe.

Whenever osuplayer is run, the data folder is created in the working directory. This is frustrating because it makes moving to new versions harder.

Describe the solution you'd like

The solution to this problem would be to store the data folder in the AppData/Roaming folder on Windows or the ~/.local/share/ directory on Linux.

Additional context

My C# is a bit rusty, but you could use the code:

Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "osuplayer");

to get ~/.local/share/osuplayer on Linux and AppData/Roaming/osuplayer on Windows.

Founntain commented 4 months ago

This makes no sense at all, usually if you update, you are supposed to overwrite your installation. yes it makes sense to store it in Appdata/Roaming, but I want to avoid it to store it there, for the ease to delete everything when the user wants to by deleting their osu!player folder

Anti-Apple4life commented 4 months ago

Maybe make it a toggle?

Founntain commented 4 months ago

Maybe make it a toggle?

I don't want to add another migration for that, because we have to migrate all current files to the other location, this would be a one time thing, but I don't see this necessary, as it never was in those 7 years. You were always supposed to overwrite your existing installation, otherwise you would end with X folders with different versions. Making it toggle-able would require more work and makes it even more confusing inside the code base.

TLDR: Don't be lazy, drag & drop and hit replace files

I appreciate the feedback tho

Founntain commented 4 months ago

I'll close this for now, as it isn't planned.

However if more people think this should be useful and don't want the simplicity of removing all fines at once instead of splitting the files across the system, then we could open this issue again

Anti-Apple4life commented 6 days ago

I am coming back to this issue because it makes the app near impossible to package because the app is installed in a privileged directory, and cannot create the files it needs:

Unhandled exception. System.UnauthorizedAccessException: Access to the path '/usr/lib/osuplayer-2/logs' is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at System.IO.FileSystem.CreateDirectory(String fullPath, UnixFileMode unixCreateMode)
   at System.IO.Directory.CreateDirectory(String path)
   at OsuPlayer.Extensions.UnhandledExceptionHandler.CreatLogsDirectoryIfItsMissing() in /home/johne/osuplayer/src/osuplayer-2024.802.0/OsuPlayer.Extensions/UnhandledExceptionHandler.cs:line 15
   at OsuPlayer.Extensions.UnhandledExceptionHandler.HandleException(Exception ex) in /home/johne/osuplayer/src/osuplayer-2024.802.0/OsuPlayer.Extensions/UnhandledExceptionHandler.cs:line 24
   at OsuPlayer.Program.Main(String[] args) in /home/johne/osuplayer/src/osuplayer-2024.802.0/OsuPlayer/Program.cs:line 46
Founntain commented 6 days ago

Lemme make this clear: You installing the player somewhere, where it does not have the permissions to create data in its own folder? So I assume that the osu!player has the same permissions as the privileged directory in that case not enough.

I don't know why you try to install the osu!player into lib as you shouldn't install software in your lib folder. As this folder is reserved for system files and managed by package managers.

Either install it in home Or in /usr/local/bin or /usr/local/lib however /usr/local/bin makes more sense as well.

Using Environment.SpecialFolder.ApplicationData on linux will return /home/,username/.configSo in the end if you install it in /home anyways we don't have to make a huge refactor of the codebase and think about already existing configs, to provide a smooth transition. Please consider that, instead of installing it somewhere where it doesn't belong

Anti-Apple4life commented 6 days ago

Lemme make this clear: You installing the player somewhere, where it does not have the permissions to create data in its own folder?

This is often how software is packaged on archlinux's AUR. Look at osu-lazer's pkgbuild, which installs it to a directory where it does not have the ability to create files. This allows the program to make one config for per user.

Although, I probably should install it under /opt/osuplayer, I need to fix the pkgbuild

Founntain commented 6 days ago

Please keep in mind, that osu-player isn't a package. This is just a zip you extract at a place where it is convenient for you. if opt/osuplayer is convenient for you install it there. Yes we could have used the Environment.SpecialFolder.ApplicationData in the first place, but we did not (). I just want to avoid a big refactor of the codebase. Because this is easy fixable from your end, as no other linux had issues with that so far.