Skip to content

Commit 15fefc3

Browse files
Fixes inconsistent .json suffix in .ini file causing crash. Updates version number to 0.0.4. Adds version number to config window.
1 parent dc6130e commit 15fefc3

File tree

7 files changed

+29
-15
lines changed

7 files changed

+29
-15
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function(setup_obs_lib_dependency target)
3434
endif()
3535
endfunction()
3636

37-
project(elgato-marketplace VERSION 0.0.3)
37+
project(elgato-marketplace VERSION 0.0.4)
3838

3939
if(${CMAKE_PROJECT_NAME} STREQUAL "obs-studio")
4040
set(OBS_FRONTEND_API_NAME "frontend-api")

buildspec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"name": "elgato-marketplace",
4242
"displayName": "Elgato Marketplace Plugin",
43-
"version": "0.0.3",
43+
"version": "0.0.4",
4444
"author": "Elgato",
4545
"website": "https://elgato.com",
4646
"email": "support@elgato.com",

src/elgato-cloud-config.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,11 @@ ElgatoCloudConfig::ElgatoCloudConfig(QWidget *parent) : QDialog(parent)
539539

540540
layout->addStretch();
541541

542+
std::string version = "v";
543+
version += PLUGIN_VERSION;
544+
auto versionLabel = new QLabel(version.c_str(), this);
545+
layout->addWidget(versionLabel);
546+
542547
auto buttons = new QHBoxLayout();
543548

544549
QPushButton* cancelButton = new QPushButton(this);

src/elgato-cloud-window.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,15 +805,15 @@ void CloseElgatoCloudWindow()
805805

806806
extern void InitElgatoCloud(obs_module_t *module)
807807
{
808-
obs_log(LOG_INFO, "version: %s", "0.0.3-maker");
808+
obs_log(LOG_INFO, "version: %s", "0.0.4");
809809

810810
elgatoCloud = new ElgatoCloud(module);
811811
QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction(
812812
"Elgato Marketplace");
813813
action->connect(action, &QAction::triggered, OpenElgatoCloudWindow);
814814
}
815815

816-
extern obs_data_t* GetElgatoCloudConfig()
816+
extern obs_data_t *GetElgatoCloudConfig()
817817
{
818818
if (elgatoCloud) {
819819
return elgatoCloud->GetConfig();

src/plugin-support.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
2121
extern void blogva(int log_level, const char *format, va_list args);
2222

2323
const char *PLUGIN_NAME = "elgato-marketplace";
24-
const char *PLUGIN_VERSION = "0.0.3";
24+
const char *PLUGIN_VERSION = "0.0.4";
2525

2626
void obs_log(int log_level, const char *format, ...)
2727
{

src/util.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,26 @@ int get_major_version()
108108
return -1;
109109
}
110110

111+
bool filename_json(std::string& filename)
112+
{
113+
const std::string suffix = ".json";
114+
if (filename.size() < suffix.size()) {
115+
return false;
116+
}
117+
return filename.compare(filename.size() - suffix.size(), suffix.size(), suffix) == 0;
118+
}
119+
111120
std::string get_current_scene_collection_filename()
112121
{
113122
int v = get_major_version();
123+
std::string filename;
114124
if (v < 31) { // Get the filename from global.ini
115125
// also in pre-31, the filename in the config file did not
116126
// have a filetype suffix.
117127
// so we need to add .json
118128
#pragma warning (disable : 4996)
119-
std::string file_name =
120-
config_get_string(obs_frontend_get_global_config(), "Basic", "SceneCollectionFile");
129+
filename = config_get_string(obs_frontend_get_global_config(), "Basic", "SceneCollectionFile");
121130
#pragma warning (default : 4996)
122-
file_name += ".json";
123-
blog(LOG_INFO, "COLLECTION FILENAME: %s", file_name.c_str());
124-
return file_name;
125131
} else { // get the filename from user.ini
126132
// in 31+ the filename stored in user.ini *does* have a filetype
127133
// suffix.
@@ -130,12 +136,14 @@ std::string get_current_scene_collection_filename()
130136
config_t* (*get_user_config)() = (config_t* (*)())sym;
131137
config_t* user_config = get_user_config();
132138
os_dlclose(obs_frontend_dll);
133-
std::string file_name =
134-
config_get_string(user_config, "Basic",
135-
"SceneCollectionFile");
136-
blog(LOG_INFO, "COLLECTION FILENAME: %s", file_name.c_str());
137-
return file_name;
139+
filename = config_get_string(user_config, "Basic", "SceneCollectionFile");
140+
}
141+
// OBS is inconsistent with adding .json to SceneCollectionFile value.
142+
if (!filename_json(filename)) {
143+
filename += ".json";
138144
}
145+
blog(LOG_INFO, "COLLECTION FILENAME: %s", filename.c_str());
146+
return filename;
139147
}
140148

141149
std::string fetch_string_from_get(std::string url, std::string token)

src/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ obs_data_t* get_module_config();
3939
void save_module_config(obs_data_t* config);
4040

4141
int get_major_version();
42+
bool filename_json(std::string& filename);
4243
std::string get_current_scene_collection_filename();
4344

4445
std::string fetch_string_from_get(std::string url, std::string token);

0 commit comments

Comments
 (0)