Skip to content

Commit 959d6cd

Browse files
Fix Linux build
1 parent 6735ddd commit 959d6cd

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/RewardsTheaterPlugin.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static const int MIN_OBS_VERSION = 503316480;
2828
static const char* const MIN_OBS_VERSION_STRING = "30.0.0";
2929

3030
RewardsTheaterPlugin::RewardsTheaterPlugin()
31-
: settings(obs_frontend_get_global_config()), ioThreadPool(std::max(2u, std::thread::hardware_concurrency())),
31+
: settings(getConfig()), ioThreadPool(std::max(2u, std::thread::hardware_concurrency())),
3232
httpClient(ioThreadPool.ioContext), twitchAuth(
3333
settings,
3434
TWITCH_CLIENT_ID,
@@ -90,6 +90,15 @@ const char* RewardsTheaterPlugin::RestrictedRegionException::what() const noexce
9090
return "RestrictedRegionException";
9191
}
9292

93+
config_t* RewardsTheaterPlugin::getConfig() {
94+
#if LIBOBS_API_MAJOR_VER >= 31
95+
// TODO: this should be obs_frontend_get_user_config, but then the settings must be migrated
96+
return obs_frontend_get_app_config();
97+
#else
98+
return obs_frontend_get_global_config();
99+
#endif
100+
}
101+
93102
void RewardsTheaterPlugin::checkMinObsVersion() {
94103
if (obs_get_version() < MIN_OBS_VERSION) {
95104
std::string message = fmt::format(

src/RewardsTheaterPlugin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#pragma once
55

6+
#include <util/config-file.h>
7+
68
#include <exception>
79

810
#include "GithubUpdateApi.h"
@@ -33,6 +35,7 @@ class RewardsTheaterPlugin {
3335
const char* what() const noexcept override;
3436
};
3537

38+
static config_t* getConfig();
3639
void checkMinObsVersion();
3740
void checkRestrictedRegion();
3841

0 commit comments

Comments
 (0)