macOS: don't use built-in filesystem implementation on Xcode 12 so we can support older macOS versions

This commit is contained in:
Iliyas Jorio 2020-12-28 13:42:52 +01:00
parent ca2d925c63
commit c8978d2bfc
3 changed files with 17 additions and 2 deletions

View File

@ -1,9 +1,11 @@
#pragma once
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) && __has_include(<filesystem>)
#if !__APPLE__ /* don't use built-in filesystem implementation so we can support older macOS versions */ && \
defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) && __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#define LEGACY_FILESYSTEM_IMPLEMENTATION 1
#include "CompilerSupport/filesystem_implementation.hpp"
namespace fs = ghc::filesystem;
#endif

View File

@ -19,7 +19,7 @@ using namespace Pomme::Files;
#define LOG POMME_GENLOG(POMME_DEBUG_FILES, "FILE")
constexpr int MAX_VOLUMES = 32767; // vRefNum is a signed short
//constexpr int MAX_VOLUMES = 32767; // vRefNum is a signed short -- commented out for now because we only have one volume
//-----------------------------------------------------------------------------
// State

View File

@ -151,6 +151,18 @@ OSErr HostVolume::OpenFork(const FSSpec* spec, ForkType forkType, char permissio
bool isAppleDoubleFile;
} candidates[] =
{
#if LEGACY_FILESYSTEM_IMPLEMENTATION
// "._NAME": ADF contained in zips created by macOS's built-in archiver
{ "._" + specName, true },
// "NAME.rsrc": ADF extracted from StuffIt/CompactPro archives by unar
{ specName + ".rsrc", true },
#if __APPLE__
// "NAME/..namedfork/rsrc": macOS-specific way to access true resource forks (not ADF)
{ specName + "/..namedfork/rsrc", false },
#endif
#else
// "._NAME": ADF contained in zips created by macOS's built-in archiver
{ u8"._" + specName, true },
@ -160,6 +172,7 @@ OSErr HostVolume::OpenFork(const FSSpec* spec, ForkType forkType, char permissio
#if __APPLE__
// "NAME/..namedfork/rsrc": macOS-specific way to access true resource forks (not ADF)
{ specName + u8"/..namedfork/rsrc", false },
#endif
#endif
};