diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index fadceee..e16007a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -12,9 +12,11 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) # Windows specific, for goog MESSAGE("_____________________ Copy Plotlylib to Tests step ___________________________________________") if(WIN32) file(COPY ${CMAKE_SOURCE_DIR}/plotly_maker/plotly-2.27.0.min.js DESTINATION - ${CMAKE_CURRENT_BINARY_DIR}/Debug/davis_htmls) + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/davis_htmls) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") file(COPY ${CMAKE_SOURCE_DIR}/plotly_maker/plotly-2.27.0.min.js DESTINATION - ${CMAKE_CURRENT_BINARY_DIR}/Release/davis_htmls) + ${CMAKE_CURRENT_BINARY_DIR}/davis_htmls) +endif() endif(WIN32) add_executable(${PROJECT_NAME}_plotly_tests PlotlyLibTest.cpp) diff --git a/common_utils/common_utils.cpp b/common_utils/common_utils.cpp index 3bb7285..8b8438d 100644 --- a/common_utils/common_utils.cpp +++ b/common_utils/common_utils.cpp @@ -5,6 +5,9 @@ namespace { + +using std::string; + #ifdef _WIN32 #include #include @@ -13,7 +16,7 @@ namespace { #include #endif -inline bool is_file_exists(const std::string& file_name) { +inline bool is_file_exists(const string& file_name) { std::ifstream file(file_name.c_str()); if (!file) { return false; @@ -21,8 +24,8 @@ inline bool is_file_exists(const std::string& file_name) { return true; } -void openFileBySystem(const std::string& file_name) { - std::string command; +void openFileBySystem(const string& file_name) { + string command; #ifdef _WIN32 command = "start "; #elif __APPLE__ @@ -40,10 +43,10 @@ void openFileBySystem(const std::string& file_name) { namespace davis { -std::string getCurrentPath() { +string getCurrentPath() { char buffer[1024]; char* answer = getcwd(buffer, sizeof(buffer)); - std::string s_cwd; + string s_cwd; if (answer) { s_cwd = answer; } @@ -54,8 +57,8 @@ bool isPlotlyScriptExists() { return is_file_exists(kPlotlyJsWorkPath); }; -bool saveStringToFile(const std::string& file_name, - const std::string& data) { +bool saveStringToFile(const string& file_name, + const string& data) { std::ofstream out(file_name); if (out.is_open()) { out << data.c_str(); @@ -66,7 +69,7 @@ bool saveStringToFile(const std::string& file_name, } -void openPlotlyHtml(const std::string& file_name) { +void openPlotlyHtml(const string& file_name) { openFileBySystem(file_name); } diff --git a/common_utils/common_utils.h b/common_utils/common_utils.h index 4079a15..c65bbb5 100644 --- a/common_utils/common_utils.h +++ b/common_utils/common_utils.h @@ -4,19 +4,20 @@ namespace davis { +using std::string; std::string getCurrentPath(); bool isPlotlyScriptExists(); -bool saveStringToFile(const std::string& file_name, - const std::string& data); +bool saveStringToFile(const string& file_name, + const string& data); void mayBeCreateJsWorkingFolder(); void sleepMs(unsigned long milisec); -void openPlotlyHtml(const std::string& file_name); +void openPlotlyHtml(const string& file_name); // Now it doesn't work. bool deleteFolder(const char* fname);