UI: Add obs_frontend_get_current_profile_path()

Returns the path of the current profile's location on the filesystem.
This commit is contained in:
tt2468
2021-07-09 17:39:40 +12:00
committed by Dillon Pentz
parent 53a8a326da
commit 9ca70f4470
5 changed files with 25 additions and 0 deletions
+10
View File
@@ -238,6 +238,16 @@ struct OBSStudioAPI : obs_frontend_callbacks {
return bstrdup(name);
}
char *obs_frontend_get_current_profile_path(void) override
{
char profilePath[512];
int ret = GetProfilePath(profilePath, sizeof(profilePath), "");
if (ret <= 0)
return nullptr;
return bstrdup(profilePath);
}
void obs_frontend_set_current_profile(const char *profile) override
{
QList<QAction *> menuActions = main->ui->profileMenu->actions();
+6
View File
@@ -204,6 +204,12 @@ char *obs_frontend_get_current_profile(void)
: nullptr;
}
char *obs_frontend_get_current_profile_path(void)
{
return !!callbacks_valid() ? c->obs_frontend_get_current_profile_path()
: nullptr;
}
void obs_frontend_set_current_profile(const char *profile)
{
if (callbacks_valid())
+1
View File
@@ -117,6 +117,7 @@ EXPORT bool obs_frontend_add_scene_collection(const char *name);
EXPORT char **obs_frontend_get_profiles(void);
EXPORT char *obs_frontend_get_current_profile(void);
EXPORT char *obs_frontend_get_current_profile_path(void);
EXPORT void obs_frontend_set_current_profile(const char *profile);
typedef void (*obs_frontend_cb)(void *private_data);
@@ -37,6 +37,7 @@ struct obs_frontend_callbacks {
virtual void
obs_frontend_get_profiles(std::vector<std::string> &strings) = 0;
virtual char *obs_frontend_get_current_profile(void) = 0;
virtual char *obs_frontend_get_current_profile_path(void) = 0;
virtual void obs_frontend_set_current_profile(const char *profile) = 0;
virtual void obs_frontend_streaming_start(void) = 0;