diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index d0be5eb..e7b8f6e 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -6,7 +6,7 @@ on: - DemoApp jobs: - build_Linux_Ubuntu: + ImGuiFileDialog_App_Linux_Dirent_FileSystem: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -28,3 +28,47 @@ jobs: name: ImGuiFileDialog path: build/ImGuiFileDialog + ImGuiFileDialog_App_Linux_Std_FileSystem: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: DemoApp + - name: checkout submodules + run : git submodule update --init --recursive + - name: Install OpenGL lib / Requirement for Glfw3 + run : sudo apt-get update && sudo apt-get install libgl1-mesa-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev + - name: configure + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_STD_FILESYSTEM=ON + - name: build + run: cmake --build build --config Release + - name: ctest + run: ctest --test-dir build --output-on-failure + - name: upload artifact + uses: actions/upload-artifact@v3 + with: + name: ImGuiFileDialog + path: build/ImGuiFileDialog + + ImGuiFileDialog_App_Linux_Boost_Demo_FileSystem: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: DemoApp + - name: checkout submodules + run : git submodule update --init --recursive + - name: Install OpenGL lib / Requirement for Glfw3 + run : sudo apt-get update && sudo apt-get install libgl1-mesa-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev + - name: configure + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_BOOST_DEMO_FILESYSTEM=ON + - name: build + run: cmake --build build --config Release + - name: ctest + run: ctest --test-dir build --output-on-failure + - name: upload artifact + uses: actions/upload-artifact@v3 + with: + name: ImGuiFileDialog + path: build/ImGuiFileDialog + diff --git a/.github/workflows/Osx.yml b/.github/workflows/Osx.yml index f81f136..1b93854 100644 --- a/.github/workflows/Osx.yml +++ b/.github/workflows/Osx.yml @@ -6,7 +6,7 @@ on: - DemoApp jobs: - build_Osx: + ImGuiFileDialog_App_Osx_Dirent_FileSystem: runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -27,3 +27,47 @@ jobs: with: name: ImGuiFileDialog_App_Macos.app path: build/ImGuiFileDialog_App_Macos.app + + ImGuiFileDialog_App_Osx_Std_FileSystem: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + ref: DemoApp + - name: checkout submodules + run : git submodule update --init --recursive + - name: Install OpenGL lib / Requirement for Glfw3 + run : brew update + - name: configure + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_STD_FILESYSTEM=ON + - name: build + run: cmake --build build --config Release + - name: ctest + run: ctest --test-dir build --output-on-failure + - name: upload artifact + uses: actions/upload-artifact@v3 + with: + name: ImGuiFileDialog_App_Macos.app + path: build/ImGuiFileDialog_App_Macos.app + + ImGuiFileDialog_App_Osx_Boost_Demo_FileSystem: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + ref: DemoApp + - name: checkout submodules + run : git submodule update --init --recursive + - name: Install OpenGL lib / Requirement for Glfw3 + run : brew update + - name: configure + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_BOOST_DEMO_FILESYSTEM=ON + - name: build + run: cmake --build build --config Release + - name: ctest + run: ctest --test-dir build --output-on-failure + - name: upload artifact + uses: actions/upload-artifact@v3 + with: + name: ImGuiFileDialog_App_Macos.app + path: build/ImGuiFileDialog_App_Macos.app diff --git a/.github/workflows/Win.yml b/.github/workflows/Win.yml index ba700b7..3b6ac07 100644 --- a/.github/workflows/Win.yml +++ b/.github/workflows/Win.yml @@ -6,7 +6,7 @@ on: - DemoApp jobs: - build_Win_latest: + ImGuiFileDialog_App_Win32_Dirent_FileSystem: runs-on: windows-latest steps: - uses: actions/checkout@v3 @@ -25,3 +25,44 @@ jobs: with: name: ImGuiFileDialog_App_WIn32 path: build\Release\ImGuiFileDialog_App_WIn32.exe + + ImGuiFileDialog_App_Win32_Std_FileSystem: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + ref: DemoApp + - name: checkout submodules + run : git submodule update --init --recursive + - name: configure + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_STD_FILESYSTEM=ON + - name: build + run: cmake --build build --config Release + - name: ctest + run: ctest --test-dir build --output-on-failure + - name: upload artifact + uses: actions/upload-artifact@v3 + with: + name: ImGuiFileDialog_App_WIn32 + path: build\Release\ImGuiFileDialog_App_WIn32.exe + + ImGuiFileDialog_App_Win32_Boost_Demo_FileSystem: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + ref: DemoApp + - name: checkout submodules + run : git submodule update --init --recursive + - name: configure + run: mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_TEST=ON -DUSE_BOOST_DEMO_FILESYSTEM=ON + - name: build + run: cmake --build build --config Release + - name: ctest + run: ctest --test-dir build --output-on-failure + - name: upload artifact + uses: actions/upload-artifact@v3 + with: + name: ImGuiFileDialog_App_WIn32 + path: build\Release\ImGuiFileDialog_App_WIn32.exe + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 69cb8d1..cca6c8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,17 +6,31 @@ set(PROJECT ImGuiFileDialog_App) enable_language(C CXX) project(${PROJECT} CXX) -option(USE_STD_FILESYSTEM "Enable std::filesystem use for path and ImGuiFileDialog" OFF) option(USE_NEW_IMGUI_KEY_SYSTEM "Define the symbol IMGUI_DISABLE_OBSOLETE_KEYIO" ON) option(USE_TEST "Enable tests" ON) +option(USE_STD_FILESYSTEM "Enable std::filesystem use for path and ImGuiFileDialog" OFF) +option(USE_BOOST_DEMO_FILESYSTEM "Enable the demo of custom filesystem here with boost" OFF) + include(cmake/3rdparty.cmake) +if (USE_BOOST_DEMO_FILESYSTEM) + add_definitions(-DCUSTOM_FILESYSTEM_INCLUDE="${CMAKE_SOURCE_DIR}/FileSystemBoost.hpp") +endif() + if(MSVC) add_definitions(-DMSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") + if (USE_STD_FILESYSTEM) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11") + endif() else () - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wunused-parameter") + if (USE_STD_FILESYSTEM) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wunused-parameter") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wunused-parameter") + endif() endif () add_definitions(${GLFW_DEFINITIONS}) @@ -111,7 +125,11 @@ else() set_target_properties(${PROJECT} PROPERTIES CXX_STANDARD 11) set_target_properties(ImGuiFileDialog PROPERTIES CXX_STANDARD 11) set_target_properties(imgui PROPERTIES CXX_STANDARD 11) - message("USE C++11 and DIRENT") + if (USE_BOOST_DEMO_FILESYSTEM) + message("USE C++11 and BOOST as demo custom filesystem") + else() + message("USE C++11 and DIRENT") + endif() endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -131,6 +149,12 @@ set_target_properties(ImGuiFileDialog PROPERTIES FOLDER Lib) target_include_directories(ImGuiFileDialog PRIVATE ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/3rdparty/boost_filesystem/include/ +) + +target_include_directories(${PROJECT} PRIVATE + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/3rdparty/boost_filesystem/include/ ) if (USE_TEST) diff --git a/CustomImGuiFileDialogConfig.h b/CustomImGuiFileDialogConfig.h index 56a0957..8f7dd41 100644 --- a/CustomImGuiFileDialogConfig.h +++ b/CustomImGuiFileDialogConfig.h @@ -5,6 +5,10 @@ // uncomment and modify defines under for customize ImGuiFileDialog +// if you need to use your FileSystem Interface, you msut define the include of your FileSystem Interface file +// if commented, you have two default interface, std::filesystem or dirent +//#define CUSTOM_FILESYSTEM_INCLUDE + //this options need c++17 // in this app its defined in CMakeLists.txt //#define USE_STD_FILESYSTEM diff --git a/FileSystemBoost.hpp b/FileSystemBoost.hpp new file mode 100644 index 0000000..ed0705f --- /dev/null +++ b/FileSystemBoost.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include +#include + +class FileSystemBoost : public IGFD::IFileSystem { +public: + bool IsDirectoryCanBeOpened(const std::string& vName) override { + return false; + } + bool IsDirectoryExist(const std::string& vName) override { + return false; + } + bool CreateDirectoryIfNotExist(const std::string& vName) override { + return false; + } + std::vector GetDrivesList() override { + std::vector res; + return res; + } + + IGFD::Utils::PathStruct ParsePathFileName(const std::string& vPathFileName) override { + IGFD::Utils::PathStruct res; + return res; + } + + std::vector ScanDirectory(const std::string& vPath) override { + std::vector res; + return res; + } + bool IsDirectory(const std::string& vFilePathName) override { + return false; + } +}; + +#define FILE_SYSTEM_OVERRIDE FileSystemBoost diff --git a/ImGuiFileDialog b/ImGuiFileDialog index cbb5cf6..99b1c0d 160000 --- a/ImGuiFileDialog +++ b/ImGuiFileDialog @@ -1 +1 @@ -Subproject commit cbb5cf6d6e32c658ac649dc74d31e478f0abd194 +Subproject commit 99b1c0d6b28ab27b83867a63ac911cbaaf93975e