-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
UI: Implement backend work for configurable storage locations for settings, profiles, and scene collections #11055
Conversation
f6a8ab6
to
b35f73c
Compare
Will require obsproject/obs-websocket#1241 to be merged first to unbreak Linux compilation. |
4e3b777
to
c6353b8
Compare
67c4598
to
c582855
Compare
c582855
to
eb71e9c
Compare
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.
Some quick general comments/questions.
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.
There are a number of naïve conversion from std::string
to std::filesystem::path
, those should all use std::filesystem::u8path
to ensure proper conversion from UTF-8. Otherwise a native encoding is assumed that - mainly on Windows - may result in invalid paths if non-ASCII characters are used.
Also see #9183 and obsproject/obs-websocket#1231
Good point, if the Unfortunately std::string utf8_encoded_filename = ...;
auto char8_view =
std::ranges::views::transform(utf8_encoded_filename,
[](char c) { return (char8_t)c; });
std::filesystem::path p(char8_view.begin(), char8_view.end()); The C++ STL discourages use of UTF-8 encoded text when using |
We disable |
eb71e9c
to
7837ab8
Compare
Pushed an update with the following changes:
This probably makes the code less efficient because of more temporary objects being created and (mostly on Windows) more character conversion taking place, but in the greater context of file system operations those losses are probably negligible. |
5946ec4
to
c471700
Compare
Yes, that fixes the crash. |
obs-websocket has been updated, so the temporary commit here can be dropped. |
c471700
to
9c6a4e5
Compare
Review comments notwithstanding, this seemed fine in my local testing. |
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.
Approval from my side pending code review from others.
9c6a4e5
to
b4ed17f
Compare
It looks like the |
This introduces a split of the current single ConfigFile instance for all configuration into two separate instances. The app config instance contains system-wide settings that mainly concern the working of the app itself, whereas the user config instance contains settings actually exposed to the user for the configuration.
This change enables loading profiles from locations different than OBS' own configuration directory. It also rewrites profile management in the app to work off an in-memory collection of profiles found on disk and does not require iterating over directory contents for most profile interactions by the app.
This change enables loading scene collections from locations different than OBS' own configuration directory. It also rewrites profile management in the app to work off an in-memory collection of profiles found on disk and does not require iterating over directory contents for most profile interactions by the app.
b4ed17f
to
b089398
Compare
Pushed an update to fix that. |
That fixed the crash again. |
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.
Seems okay.
Description
This PR implements backend changes required to make the storage locations of settings, profiles, and scene collections configurable and decoupled from OBS' current default storage location for its settings, log files, crash logs, and other generated files.
This is achieved in 3 major parts:
The implementation also introduces additional changes:
std::string_view
,std::filesystem
and others.using namespace std
was avoided as much as possible as it's a bad design pattern, when functionality fromstd
was used, it's made explicitstd::optional
(where it's use of copies were deemed good enough) or reference types to keep using value semantics as much as possiblebasicConfig
was renamed toactiveConfiguration
because it represents the currently active configuration object in use by the application (it's a state-dependent variable).Architecturally an attempt was made to introduce some encapsulation to the management of profiles and scene collections. Available scene collections or profiles are discovered on disk and cached in memory (with refreshes from disk happening only when explicitly requested).
Handling of encoder configuration (which is stored in separate JSON files next to the profile settings file) has not been changed, but should be moved out of the encoder configuration and into the profile management, but was out of scope for this PR.
Motivation and Context
The long-term goal of this work is to enable placing configuration files as well as profiles and scene collections in arbitrary locations provided by the user, such as:
How Has This Been Tested?
Tested on macOS 14 with the following scenarios:
user.ini
Types of changes
Checklist: