From 9ef03d4ee031fcffd1dd40409293d292f83f88cd Mon Sep 17 00:00:00 2001 From: aseelegbaria Date: Tue, 28 Jul 2020 20:35:24 +0300 Subject: [PATCH] documents folder --- common/model-views.cpp | 2 +- common/ux-window.cpp | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/common/model-views.cpp b/common/model-views.cpp index fcdc96fe7e..052a96b3a1 100644 --- a/common/model-views.cpp +++ b/common/model-views.cpp @@ -4717,7 +4717,7 @@ namespace rs2 std::string default_path = config_file::instance().get(configurations::record::default_path); if (!ends_with(default_path, "/") && !ends_with(default_path, "\\")) default_path += "/"; std::string default_filename = rs2::get_timestamped_file_name() + ".bag"; - if (recording_setting == 0) + if (recording_setting == 0 && default_path.size() > 1 ) { path = default_path + default_filename; } diff --git a/common/ux-window.cpp b/common/ux-window.cpp index 656d5aeab9..1440efd86a 100644 --- a/common/ux-window.cpp +++ b/common/ux-window.cpp @@ -57,7 +57,6 @@ namespace rs2 config_file::instance().set_default(configurations::window::saved_size, false); config_file::instance().set_default(configurations::viewer::is_measuring, false); - config_file::instance().set_default(configurations::viewer::log_filename, get_folder_path(special_folder::user_documents) + "librealsense.log"); config_file::instance().set_default(configurations::viewer::log_to_console, true); config_file::instance().set_default(configurations::viewer::log_to_file, false); config_file::instance().set_default(configurations::viewer::log_severity, 2); @@ -65,7 +64,6 @@ namespace rs2 config_file::instance().set_default(configurations::viewer::ground_truth_r, 2500); config_file::instance().set_default(configurations::record::compression_mode, 2); // Let the device decide - config_file::instance().set_default(configurations::record::default_path, get_folder_path(special_folder::user_documents)); config_file::instance().set_default(configurations::record::file_save_mode, 0); // Auto-select name config_file::instance().set_default(configurations::performance::show_fps, false); @@ -79,6 +77,20 @@ namespace rs2 config_file::instance().set_default(configurations::viewer::commands_xml, "./Commands.xml"); config_file::instance().set_default(configurations::viewer::hwlogger_xml, "./HWLoggerEvents.xml"); + std::string path; + try + { + path = get_folder_path(special_folder::user_documents); + } + catch (const std::exception& e) + { + std::string msg = "Failed to get Documents folder"; + rs2::log(RS2_LOG_SEVERITY_INFO, msg.c_str()); + path = ""; + } + config_file::instance().set_default(configurations::viewer::log_filename, path + "librealsense.log"); + config_file::instance().set_default(configurations::record::default_path, path); + #ifdef __APPLE__ config_file::instance().set_default(configurations::performance::font_oversample, 2);