From b05ed1a886c11549a1ac4453adb155ac5dc58cc1 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 19 May 2025 13:08:21 +0200 Subject: [PATCH] fix more fs throws and add jxl to windows cd --- .github/workflows/cd.yml | 8 ++--- src/chat_gui/file_selector.cpp | 56 +++++++++++++++++++++------------- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 69bdfe7..f98f602 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -188,7 +188,7 @@ jobs: env: VCPKG_FEATURE_FLAGS: "binarycaching" VCPKG_BINARY_SOURCES: "clear;files,${{steps.vcpkg-cache.outputs.path}},readwrite" - run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static opus:x64-windows-static libvpx:x64-windows-static zstd:x64-windows-static libwebp:x64-windows-static libpng:x64-windows-static libjpeg-turbo:x64-windows-static freetype:x64-windows-static + run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static opus:x64-windows-static libvpx:x64-windows-static zstd:x64-windows-static libwebp:x64-windows-static libpng:x64-windows-static libjpeg-turbo:x64-windows-static libjxl:x64-windows-static freetype:x64-windows-static # setup vs env - uses: ilammy/msvc-dev-cmd@v1 @@ -199,7 +199,7 @@ jobs: #- uses: ilammy/setup-nasm@v1 - name: Configure CMake - run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_BREAKPAD=ON -DTOMATO_TOX_AV=ON + run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=ON -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_BREAKPAD=ON -DTOMATO_TOX_AV=ON - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -t tomato @@ -262,7 +262,7 @@ jobs: env: VCPKG_FEATURE_FLAGS: "binarycaching" VCPKG_BINARY_SOURCES: "clear;files,${{steps.vcpkg-cache.outputs.path}},readwrite" - run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static opus:x64-windows-static libvpx:x64-windows-static zstd:x64-windows-static libwebp:x64-windows-static libpng:x64-windows-static libjpeg-turbo:x64-windows-static freetype:x64-windows-static + run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static opus:x64-windows-static libvpx:x64-windows-static zstd:x64-windows-static libwebp:x64-windows-static libpng:x64-windows-static libjpeg-turbo:x64-windows-static libjxl:x64-windows-static freetype:x64-windows-static # setup vs env @@ -274,7 +274,7 @@ jobs: #- uses: ilammy/setup-nasm@v1 - name: Configure CMake - run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_ASAN=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_TOX_AV=ON + run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DTOMATO_ASAN=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DTOMATO_DEP_LIBWEBP_USE_SYSTEM=ON -DSDLIMAGE_VENDORED=OFF -DSDLIMAGE_DEPS_SHARED=OFF -DSDLIMAGE_JXL=ON -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_TOX_AV=ON - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato diff --git a/src/chat_gui/file_selector.cpp b/src/chat_gui/file_selector.cpp index 644ecb2..89e27ee 100644 --- a/src/chat_gui/file_selector.cpp +++ b/src/chat_gui/file_selector.cpp @@ -224,13 +224,17 @@ void FileSelector::render(void) { } ImGui::PushID(tmp_id++); if (ImGui::Selectable("D", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) { - _current_file_path = dir_entry.path() / ""; + try { + _current_file_path = dir_entry.path() / ""; + } catch (...) {} } ImGui::PopID(); } if (ImGui::TableNextColumn()) { - ImGui::TextUnformatted((dir_entry.path().filename().generic_u8string() + "/").c_str()); + try { + ImGui::TextUnformatted((dir_entry.path().filename().generic_u8string() + "/").c_str()); + } catch (...) {} } if (ImGui::TableNextColumn()) { @@ -238,15 +242,17 @@ void FileSelector::render(void) { } if (ImGui::TableNextColumn()) { - const auto file_time_converted = std::chrono::time_point_cast( - dir_entry.last_write_time() - - decltype(dir_entry.last_write_time())::clock::now() - + std::chrono::system_clock::now() - ); - const auto ctime = std::chrono::system_clock::to_time_t(file_time_converted); + try { + const auto file_time_converted = std::chrono::time_point_cast( + dir_entry.last_write_time() + - decltype(dir_entry.last_write_time())::clock::now() + + std::chrono::system_clock::now() + ); + const auto ctime = std::chrono::system_clock::to_time_t(file_time_converted); - const auto ltime = std::localtime(&ctime); - ImGui::TextDisabled("%2d.%2d.%2d - %2d:%2d", ltime->tm_mday, ltime->tm_mon + 1, ltime->tm_year + 1900, ltime->tm_hour, ltime->tm_min); + const auto ltime = std::localtime(&ctime); + ImGui::TextDisabled("%2d.%2d.%2d - %2d:%2d", ltime->tm_mday, ltime->tm_mon + 1, ltime->tm_year + 1900, ltime->tm_hour, ltime->tm_min); + } catch (...) {} } } } @@ -260,29 +266,37 @@ void FileSelector::render(void) { if (ImGui::TableNextColumn()) { ImGui::PushID(tmp_id++); if (ImGui::Selectable("F", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) { - _current_file_path = file_entry.path(); + try { + _current_file_path = file_entry.path(); + } catch(...) {} } ImGui::PopID(); } if (ImGui::TableNextColumn()) { - ImGui::TextUnformatted(file_entry.path().filename().generic_u8string().c_str()); + try { + ImGui::TextUnformatted(file_entry.path().filename().generic_u8string().c_str()); + } catch(...) {} } if (ImGui::TableNextColumn()) { - ImGui::TextDisabled("%s", std::to_string(file_entry.file_size()).c_str()); + try { + ImGui::TextDisabled("%s", std::to_string(file_entry.file_size()).c_str()); + } catch(...) {} } if (ImGui::TableNextColumn()) { - const auto file_time_converted = std::chrono::time_point_cast( - file_entry.last_write_time() - - decltype(file_entry.last_write_time())::clock::now() - + std::chrono::system_clock::now() - ); - const auto ctime = std::chrono::system_clock::to_time_t(file_time_converted); + try { + const auto file_time_converted = std::chrono::time_point_cast( + file_entry.last_write_time() + - decltype(file_entry.last_write_time())::clock::now() + + std::chrono::system_clock::now() + ); + const auto ctime = std::chrono::system_clock::to_time_t(file_time_converted); - const auto ltime = std::localtime(&ctime); - ImGui::TextDisabled("%2d.%2d.%2d - %2d:%2d", ltime->tm_mday, ltime->tm_mon, ltime->tm_year + 1900, ltime->tm_hour, ltime->tm_min); + const auto ltime = std::localtime(&ctime); + ImGui::TextDisabled("%2d.%2d.%2d - %2d:%2d", ltime->tm_mday, ltime->tm_mon, ltime->tm_year + 1900, ltime->tm_hour, ltime->tm_min); + } catch(...) {} } } }