From 74cab50ceeb2702863d1efb9f07a3ef7f26b87c1 Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Sun, 5 Jul 2020 13:20:03 +0100 Subject: [PATCH] Remove dependency on std::filesystem and fix a compilation error. --- source/frontends/ncurses/CMakeLists.txt | 7 ------- source/frontends/ncurses/configuration.cpp | 4 ++-- source/linux/duplicates/Speaker.cpp | 16 ++++++++++++++++ source/linux/windows/files.cpp | 6 ++---- 4 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 source/linux/duplicates/Speaker.cpp diff --git a/source/frontends/ncurses/CMakeLists.txt b/source/frontends/ncurses/CMakeLists.txt index ba20dbf4..26b15416 100644 --- a/source/frontends/ncurses/CMakeLists.txt +++ b/source/frontends/ncurses/CMakeLists.txt @@ -27,7 +27,6 @@ target_compile_options(applen PRIVATE ${NCURSESW_CFLAGS_OTHER} ${LIBEVDEV_CFLAGS_OTHER} ) -target_compile_features(applen PUBLIC cxx_std_17) target_link_libraries(applen PRIVATE ${NCURSESW_LIBRARIES} @@ -36,11 +35,5 @@ target_link_libraries(applen PRIVATE appleii ) -if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) - target_link_libraries(applen PRIVATE - stdc++fs - ) -endif() - add_custom_target(copy-resources ALL COMMAND cmake -E copy_directory ${CMAKE_SOURCE_DIR}/resource ${CMAKE_BINARY_DIR}/resource) diff --git a/source/frontends/ncurses/configuration.cpp b/source/frontends/ncurses/configuration.cpp index f62c1e87..88c4ca60 100644 --- a/source/frontends/ncurses/configuration.cpp +++ b/source/frontends/ncurses/configuration.cpp @@ -1,9 +1,9 @@ #include "frontends/ncurses/configuration.h" #include "Log.h" +#include "linux/windows/files.h" #include -#include class Configuration { @@ -31,7 +31,7 @@ std::shared_ptr Configuration::instance; Configuration::Configuration(const std::string & filename) : myFilename(filename) { - if (std::filesystem::exists(filename)) + if (GetFileAttributes(myFilename.c_str()) != INVALID_FILE_ATTRIBUTES) { boost::property_tree::ini_parser::read_ini(myFilename, myINI); } diff --git a/source/linux/duplicates/Speaker.cpp b/source/linux/duplicates/Speaker.cpp new file mode 100644 index 00000000..5d175293 --- /dev/null +++ b/source/linux/duplicates/Speaker.cpp @@ -0,0 +1,16 @@ +#include "StdAfx.h" + +#include "YamlHelper.h" +#include "Common.h" + +void SpkrLoadSnapshot(YamlLoadHelper&) +{ +} + +void SpkrSaveSnapshot(YamlSaveHelper&) +{ +} + +void SpkrUpdate_Timer() +{ +} diff --git a/source/linux/windows/files.cpp b/source/linux/windows/files.cpp index edd69154..faae48a3 100644 --- a/source/linux/windows/files.cpp +++ b/source/linux/windows/files.cpp @@ -113,10 +113,8 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD GetFileAttributes(const char * filename) { - const int exists = access(filename, F_OK); - if (exists) - return INVALID_FILE_ATTRIBUTES; - + // minimum is R_OK + // no point checking F_OK as it is useless const int read = access(filename, R_OK); if (read) return INVALID_FILE_ATTRIBUTES;