From 7ee008e150bc5bcf76082d726f719ee0fdfda982 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Wed, 11 Feb 2026 02:37:39 -0600 Subject: Fluorine Manager: full Linux port of Mod Organizer 2 Complete native Linux port with FUSE-based virtual filesystem, Proton/umu-run integration, and Flatpak packaging. Key features: - FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak) - Proton/GE-Proton/umu-run launcher with env var forwarding - Flatpak support (sandbox-aware VFS, NXM handler, umu-run) - Wine prefix management UI - Case-insensitive path resolution for Linux filesystems - QSettings-safe INI handling (avoids Bethesda INI corruption) - Portable instance support with auto-generated launcher scripts Co-Authored-By: Claude Opus 4.6 --- libs/libbsarch/src/utils/string_convert.cpp | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 libs/libbsarch/src/utils/string_convert.cpp (limited to 'libs/libbsarch/src/utils/string_convert.cpp') diff --git a/libs/libbsarch/src/utils/string_convert.cpp b/libs/libbsarch/src/utils/string_convert.cpp new file mode 100644 index 0000000..1e8ce9e --- /dev/null +++ b/libs/libbsarch/src/utils/string_convert.cpp @@ -0,0 +1,39 @@ +/* Copyright (C) 2019 G'k + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +#include "string_convert.hpp" + +#include +#include + +namespace libbsarch { + +std::string to_string(const std::wstring &str) +{ + if (str.empty()) return {}; + std::mbstate_t state{}; + const wchar_t* src = str.data(); + std::size_t len = std::wcsrtombs(nullptr, &src, 0, &state); + if (len == static_cast(-1)) return {}; + std::string result(len, '\0'); + src = str.data(); + state = std::mbstate_t{}; + std::wcsrtombs(result.data(), &src, len + 1, &state); + return result; +} + +std::wstring to_wstring(const std::string &str) +{ + if (str.empty()) return {}; + std::mbstate_t state{}; + const char* src = str.data(); + std::size_t len = std::mbsrtowcs(nullptr, &src, 0, &state); + if (len == static_cast(-1)) return {}; + std::wstring result(len, L'\0'); + src = str.data(); + state = std::mbstate_t{}; + std::mbsrtowcs(result.data(), &src, len + 1, &state); + return result; +} +} // namespace libbsarch -- cgit v1.3.1