-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unix, win32: Allow set the default libretro_directory via environment variable #12040
Conversation
@iyzsong This PR has merge conflict. Please fix this. |
Rebased and adjust code style, thank you. |
Hi there, sorry for the holdup. I'll ask some other members their thoughts on this. |
@iyzsong I'm afraid this is the wrong approach.
If you want to set the default core path based on an environment viable on Unix-based systems, then you will need to do this in RetroArch/frontend/drivers/platform_unix.c Lines 1818 to 1819 in 514534f
i.e. |
@jdgleaver Glad to learn, I'll update this to use |
Code updated to |
why not doing the same on other OSes as well like Windows? i am prolly going to use this in some scripts. |
Hi, you'd still have to fix this code. This will fail C89 validation right now. Variables need to be declared at either the top of a code function or block. @jdgleaver Looking past that, what is your general opinion on this PR now? Is it something fit for merge or not? |
Aside from the C89 build fix, I would also advise changing: if (libretro_directory)
strlcat(g_defaults.dirs[DEFAULT_DIR_CORE], libretro_directory,
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); to: if (!string_is_empty(libretro_directory))
strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE], libretro_directory,
sizeof(g_defaults.dirs[DEFAULT_DIR_CORE])); Other than that, I see no issues with the PR - the essential functionality is fine. |
@iyzsong Please fix these nits :) |
Fixed, also apply for win32 (not tested). |
@iyzsong Apologies, but the change you made here is wrong. All Also, I would appreciate a more descriptive variable name than It's not an important issue, but it's just good practice to avoid potential variable shadowing ( |
@iyzsong please fix these nits :) |
@ofry @jdgleaver Sorry for the delay, should be fixed now :) |
@iyzsong Thanks, this looks fine now :) |
This fetch translation again??? |
I know nothing about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of setting more of the configuration through environment variables.
I could see this being useful outside of just the libretro_directory
too. What are your thoughts on applying a similar pattern to other configurations? We could eventually make it all generic config system.
Do it and fix this translation crap again. |
@RobLoach Please re-review this. |
It is working if I tested only on Linux with
Main tab > Load Core. Thank you. |
What if it is defined in the configuration? |
Sorry I should have been more clear. I meant |
@iyzsong Please fix this bug in your PR. |
Hello, when
And set g_defaults.dirs[DEFAULT_DIR_CORE] will only have effect when it's not already set in the config file... |
@iyzsong Thank you for the feedback. So it is working on Linux. There is a little typo on the title
If possible somebody should try to make a test on Windows. |
@gouchi Ah, good catch, thank you! |
It seems strange that setting Could we consider changing its behavior to take precedence over the config file? If the current behavior is desirable somehow, we could introduce a I was looking into adding a LIBRETRO_ASSETS_DIRECTORY for auto-discovery when using RetroArch with an asset packaging in Guix, and having it written to the retroarch.cfg file is problematic, as it then never gets updated and could go stale. |
Perhaps introducing a
|
Unless there's a clear use case for LIBRETRO_DIRECTORY_DEFAULT, I suggest we start with simply modifying LIBRETRO_DIRECTORY (it still works the way it was, but it also overrides any configured value from the config file). See: #17054 |
Hello, this patch allow set
libretro_directory
via an environment variableLIBRETRO_DIRECTORY
.It's useful for the package manager
guix
, which dosen't install files under /usr, /lib etc. and disabled the core updater, but have a way to set environment variables to paths in profile (where packages are installed into).My usage for it: https://issues.guix.gnu.org/46588