From e56f39aa0cefa718005810a61a8390078ecd10ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Mon, 26 Oct 2015 13:40:39 +0100 Subject: [PATCH] Use correct operators for concatination of paths --- src/cmake.cc | 12 ++++++------ src/dialogs.cc | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cmake.cc b/src/cmake.cc index 883b49a..334a1ab 100644 --- a/src/cmake.cc +++ b/src/cmake.cc @@ -17,9 +17,9 @@ CMake::CMake(const boost::filesystem::path &path) { return false; }; - auto search_path=boost::filesystem::path(path); + auto search_path=path; auto search_cmake_path=search_path; - search_cmake_path+="/CMakeLists.txt"; + search_cmake_path/="CMakeLists.txt"; if(boost::filesystem::exists(search_cmake_path)) paths.emplace(paths.begin(), search_cmake_path); if(find_cmake_project(search_cmake_path)) @@ -28,7 +28,7 @@ CMake::CMake(const boost::filesystem::path &path) { do { search_path=search_path.parent_path(); search_cmake_path=search_path; - search_cmake_path+="/CMakeLists.txt"; + search_cmake_path/="CMakeLists.txt"; if(boost::filesystem::exists(search_cmake_path)) paths.emplace(paths.begin(), search_cmake_path); if(find_cmake_project(search_cmake_path)) { @@ -37,8 +37,8 @@ CMake::CMake(const boost::filesystem::path &path) { } } while(search_path!=search_path.root_directory()); } - if(project_path!="") { - if(boost::filesystem::exists(project_path.string()+"/CMakeLists.txt") && !boost::filesystem::exists(project_path.string()+"/compile_commands.json")) + if(!project_path.empty()) { + if(boost::filesystem::exists(project_path/"CMakeLists.txt") && !boost::filesystem::exists(project_path/"compile_commands.json")) create_compile_commands(project_path); } } @@ -48,7 +48,7 @@ bool CMake::create_compile_commands(const boost::filesystem::path &path) { if(Singleton::terminal()->execute(Singleton::Config::terminal()->cmake_command+" . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON", path)==EXIT_SUCCESS) { #ifdef _WIN32 //Temporary fix to MSYS2's libclang auto compile_commands_path=path; - compile_commands_path+="/compile_commands.json"; + compile_commands_path/="compile_commands.json"; auto compile_commands_file=filesystem::read(compile_commands_path); size_t pos=0; while((pos=compile_commands_file.find("-I/", pos))!=std::string::npos) { diff --git a/src/dialogs.cc b/src/dialogs.cc index ab48ced..56fb0c9 100644 --- a/src/dialogs.cc +++ b/src/dialogs.cc @@ -8,10 +8,10 @@ std::string open_dialog(const std::string &title, Gtk::FileChooserAction gtk_options, const std::string &file_name = "") { Gtk::FileChooserDialog dialog(title, gtk_options); - if(Singleton::directories()->current_path!="") - gtk_file_chooser_set_current_folder((GtkFileChooser*)dialog.gobj(), Singleton::directories()->current_path.string().c_str()); + if(!Singleton::directories()->current_path.empty()) + gtk_file_chooser_set_current_folder((GtkFileChooser*)dialog.gobj(), Singleton::directories()->current_path.c_str()); else - gtk_file_chooser_set_current_folder((GtkFileChooser*)dialog.gobj(), boost::filesystem::current_path().string().c_str()); + gtk_file_chooser_set_current_folder((GtkFileChooser*)dialog.gobj(), boost::filesystem::current_path().c_str()); if (!file_name.empty()) gtk_file_chooser_set_filename((GtkFileChooser*)dialog.gobj(), file_name.c_str()); dialog.set_position(Gtk::WindowPosition::WIN_POS_CENTER_ALWAYS);