diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
| commit | 7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch) | |
| tree | 27fb39be241fdb5ac2734c574de678977d1856d0 /libs/archive/src/compat.h | |
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 <noreply@anthropic.com>
Diffstat (limited to 'libs/archive/src/compat.h')
| -rw-r--r-- | libs/archive/src/compat.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/libs/archive/src/compat.h b/libs/archive/src/compat.h new file mode 100644 index 0000000..65c2ec5 --- /dev/null +++ b/libs/archive/src/compat.h @@ -0,0 +1,87 @@ +/* +Mod Organizer archive handling - Linux compatibility header + +Copyright (C) 2024 MO2 Team. All rights reserved. + +This header provides Windows COM compatibility types for Linux builds. +On Windows, the real Windows headers are used instead. +*/ + +#ifndef ARCHIVE_COMPAT_H +#define ARCHIVE_COMPAT_H + +#ifdef _WIN32 + +#include <Unknwn.h> +#include <atlbase.h> +#include <initguid.h> +#include <guiddef.h> +#include <PropIdl.h> + +#else // Linux + +#include <Common/MyWindows.h> +#include <cstring> + +// PropVariantInit / PropVariantClear - map to VariantClear from 7zip SDK +inline HRESULT PropVariantInit(PROPVARIANT* pvar) { + pvar->vt = VT_EMPTY; + return S_OK; +} + +inline HRESULT PropVariantClear(PROPVARIANT* pvar) { + return VariantClear(pvar); +} + +// A minimal CComPtr replacement for Linux +template <class T> +class CComPtr +{ +public: + CComPtr() : p(nullptr) {} + CComPtr(T* lp) : p(lp) { if (p) p->AddRef(); } + CComPtr(const CComPtr<T>& other) : p(other.p) { if (p) p->AddRef(); } + ~CComPtr() { Release(); } + + CComPtr& operator=(T* lp) { + if (lp) lp->AddRef(); + Release(); + p = lp; + return *this; + } + + CComPtr& operator=(const CComPtr<T>& other) { + if (this != &other) { + if (other.p) other.p->AddRef(); + Release(); + p = other.p; + } + return *this; + } + + void Release() { + if (p) { + p->Release(); + p = nullptr; + } + } + + T* Detach() { + T* pt = p; + p = nullptr; + return pt; + } + + operator T*() const { return p; } + T* operator->() const { return p; } + T** operator&() { return &p; } + bool operator!() const { return p == nullptr; } + bool operator==(std::nullptr_t) const { return p == nullptr; } + bool operator!=(std::nullptr_t) const { return p != nullptr; } + + T* p; +}; + +#endif // _WIN32 + +#endif // ARCHIVE_COMPAT_H |
