Skip to content

Commit 81ea3de

Browse files
author
Gin
committed
Log program setting JSON file path
1 parent 470b3ea commit 81ea3de

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ const std::string& SETTINGS_PATH(){
152152
static std::string path = get_setting_path();
153153
return path;
154154
}
155+
const std::string& PROGRAM_SETTING_JSON_PATH(){
156+
static std::string path = SETTINGS_PATH() + QCoreApplication::applicationName().toStdString() + "-Settings.json";
157+
return path;
158+
}
155159
const std::string& SCREENSHOTS_PATH(){
156160
static std::string path = get_screenshot_path();
157161
return path;

SerialPrograms/Source/CommonFramework/Globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ extern const size_t LOG_HISTORY_LINES;
3737

3838
// Folder path (end with "/") to hold program setting files.
3939
const std::string& SETTINGS_PATH();
40+
// The setting JSON file path. This path is a child of the folder SETTINGS_PATH().
41+
const std::string& PROGRAM_SETTING_JSON_PATH();
4042

4143
// Folder path (end with "/") to hold screenshots from the program "Screenshot" button.
4244
const std::string& SCREENSHOTS_PATH();

SerialPrograms/Source/CommonFramework/Main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ int main(int argc, char *argv[]){
7272
return 1;
7373
}
7474

75+
std::cout << "Loading from program setting JSON: " << PROGRAM_SETTING_JSON_PATH() << std::endl;
7576
PERSISTENT_SETTINGS().read();
7677

7778
if (!migrate_stats(global_logger_tagged())){

SerialPrograms/Source/CommonFramework/PersistentSettings.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,16 @@ void PersistentSettings::write() const{
4141
root["99-Panels"] = panels.clone();
4242

4343
try{
44-
std::string settings_path = SETTINGS_PATH() + QCoreApplication::applicationName().toStdString() + "-Settings.json";
45-
root.dump(settings_path);
44+
root.dump(PROGRAM_SETTING_JSON_PATH());
4645
}catch (FileException&){}
4746
}
4847

4948

5049
void PersistentSettings::read(){
51-
std::string settings_path = SETTINGS_PATH() + QCoreApplication::applicationName().toStdString() + "-Settings.json";
52-
JsonValue json = load_json_file(settings_path);
50+
JsonValue json = load_json_file(PROGRAM_SETTING_JSON_PATH());
5351
JsonObject* obj = json.to_object();
5452
if (obj == nullptr){
55-
throw FileException(nullptr, PA_CURRENT_FUNCTION, "Invalid settings file.", settings_path);
53+
throw FileException(nullptr, PA_CURRENT_FUNCTION, "Invalid settings file.", PROGRAM_SETTING_JSON_PATH());
5654
}
5755

5856
// Need to load this subset of settings first because they will affect how

SerialPrograms/Source/Tests/CommandLineTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ int run_command_line_tests(){
180180
}
181181

182182
QFileInfo test_root_info(root_folder_name.c_str());
183+
cout << "Looking for tests under test root folder: " << root_folder_name << endl;
183184

184185
size_t num_passed = 0;
185186

0 commit comments

Comments
 (0)