aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_fomod
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-14 15:40:33 -0600
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-14 15:40:33 -0600
commit6410929e17d642618f284d5c97d457f1ac653e6e (patch)
tree5c0ee09e04f38a2dd70f1734d25c74e0b8ae5d43 /libs/installer_fomod
parent817e8f5cd26739c69d930d21cd9dc4c0b6e4984e (diff)
Migrate data paths to ~/.local/share/fluorine/, add native build, fix %command% and system Proton scanning
- All data paths migrated from ~/.var/app/com.fluorine.manager/ to ~/.local/share/fluorine/ so native and Flatpak builds share the same instances, plugins, and configs - New fluorinepaths.h/.cpp with fluorineDataDir() helper and one-time migration from old path (writes MOVED.txt breadcrumb) - New libs/nak/src/paths.rs as Rust equivalent (data_dir()) - Strip %command% tokens from launch wrapper in protonlauncher.cpp - Always scan /usr/share/steam/compatibilitytools.d/ for system Proton packages (Arch installs Proton there); add Flatpak filesystem permission - Native build (build-native.sh) installs to ~/.local/share/fluorine/ with desktop entry and ~/.local/bin symlink instead of portable zip - build-flatpak.sh wrapper for Flatpak builds - Fix container locale (LANG=C.UTF-8) for AutoUic warnings - Fix prefixExists() to handle both compatdata and pfx directory layouts - Fix globalInstancesRootPath() to use fluorineDataDir() on Linux - Fix umu-run Flatpak lookup to use fluorineDataDir() - Update README with build instructions and Arch dependency list Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/installer_fomod')
-rw-r--r--libs/installer_fomod/src/fomodinstallerdialog.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/libs/installer_fomod/src/fomodinstallerdialog.cpp b/libs/installer_fomod/src/fomodinstallerdialog.cpp
index 0fa6bfc..f675e3d 100644
--- a/libs/installer_fomod/src/fomodinstallerdialog.cpp
+++ b/libs/installer_fomod/src/fomodinstallerdialog.cpp
@@ -127,11 +127,15 @@ int FomodInstallerDialog::bomOffset(const QByteArray& buffer)
static const unsigned char BOM_UTF8[] = {0xEF, 0xBB, 0xBF};
static const unsigned char BOM_UTF16BE[] = {0xFE, 0xFF};
static const unsigned char BOM_UTF16LE[] = {0xFF, 0xFE};
+ auto startsWithBytes = [&buffer](const unsigned char* bytes, qsizetype size) {
+ return buffer.startsWith(
+ QByteArrayView(reinterpret_cast<const char*>(bytes), size));
+ };
- if (buffer.startsWith(reinterpret_cast<const char*>(BOM_UTF8)))
+ if (startsWithBytes(BOM_UTF8, sizeof(BOM_UTF8)))
return 3;
- if (buffer.startsWith(reinterpret_cast<const char*>(BOM_UTF16BE)) ||
- buffer.startsWith(reinterpret_cast<const char*>(BOM_UTF16LE)))
+ if (startsWithBytes(BOM_UTF16BE, sizeof(BOM_UTF16BE)) ||
+ startsWithBytes(BOM_UTF16LE, sizeof(BOM_UTF16LE)))
return 2;
return 0;
@@ -150,25 +154,30 @@ QByteArray skipXmlHeader(QIODevice& file)
static const unsigned char UTF16LE[] = {0x3C, 0x00, 0x3F, 0x00};
static const unsigned char UTF16BE[] = {0x00, 0x3C, 0x00, 0x3F};
static const unsigned char UTF8[] = {0x3C, 0x3F, 0x78, 0x6D};
+ auto startsWithBytes = [](const QByteArray& bytes, const unsigned char* prefix,
+ qsizetype size) {
+ return bytes.startsWith(
+ QByteArrayView(reinterpret_cast<const char*>(prefix), size));
+ };
file.seek(0);
QByteArray rawBytes = file.read(4);
QTextStream stream(&file);
int bom = 0;
- if (rawBytes.startsWith((const char*)UTF16LE_BOM)) {
+ if (startsWithBytes(rawBytes, UTF16LE_BOM, sizeof(UTF16LE_BOM))) {
stream.setEncoding(QStringConverter::Encoding::Utf16LE);
bom = 2;
- } else if (rawBytes.startsWith((const char*)UTF16BE_BOM)) {
+ } else if (startsWithBytes(rawBytes, UTF16BE_BOM, sizeof(UTF16BE_BOM))) {
stream.setEncoding(QStringConverter::Encoding::Utf16BE);
bom = 2;
- } else if (rawBytes.startsWith((const char*)UTF8_BOM)) {
+ } else if (startsWithBytes(rawBytes, UTF8_BOM, sizeof(UTF8_BOM))) {
stream.setEncoding(QStringConverter::Encoding::Utf8);
bom = 3;
- } else if (rawBytes.startsWith(QByteArray((const char*)UTF16LE, 4))) {
+ } else if (startsWithBytes(rawBytes, UTF16LE, sizeof(UTF16LE))) {
stream.setEncoding(QStringConverter::Encoding::Utf16LE);
- } else if (rawBytes.startsWith(QByteArray((const char*)UTF16BE, 4))) {
+ } else if (startsWithBytes(rawBytes, UTF16BE, sizeof(UTF16BE))) {
stream.setEncoding(QStringConverter::Encoding::Utf16BE);
- } else if (rawBytes.startsWith(QByteArray((const char*)UTF8, 4))) {
+ } else if (startsWithBytes(rawBytes, UTF8, sizeof(UTF8))) {
stream.setEncoding(QStringConverter::Encoding::Utf8);
} // otherwise maybe the textstream knows the encoding?