Merge branch 'master' of ssh+git://git.axiodl.com:6431/AxioDL/hecl

This commit is contained in:
Phillip Stephens 2019-08-15 20:38:08 -07:00
commit 8f8dd5342f
6 changed files with 160 additions and 118 deletions

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit af50bc0bc21855dbe2b49cb5b40fdde1f4a925f9 Subproject commit 0121d355c4ccceb477c5a3ed83658c6c220212ee

View File

@ -18,28 +18,36 @@ class FourCC {
protected: protected:
union { union {
char fcc[4]; char fcc[4];
uint32_t num; uint32_t num = 0;
}; };
public: public:
constexpr FourCC() /* Sentinel FourCC */ // Sentinel FourCC
: num(0) {} constexpr FourCC() noexcept = default;
constexpr FourCC(const FourCC& other) : num(other.num) {} constexpr FourCC(const FourCC& other) noexcept = default;
constexpr FourCC(const char* name) : num(*(uint32_t*)name) {} constexpr FourCC(FourCC&& other) noexcept = default;
constexpr FourCC(uint32_t n) : num(n) {} constexpr FourCC(const char* name) noexcept : fcc{name[0], name[1], name[2], name[3]} {}
bool operator==(const FourCC& other) const { return num == other.num; } constexpr FourCC(uint32_t n) noexcept : num(n) {}
bool operator!=(const FourCC& other) const { return num != other.num; }
bool operator==(const char* other) const { return num == *(uint32_t*)other; } constexpr FourCC& operator=(const FourCC&) noexcept = default;
bool operator!=(const char* other) const { return num != *(uint32_t*)other; } constexpr FourCC& operator=(FourCC&&) noexcept = default;
bool operator==(int32_t other) const { return num == uint32_t(other); }
bool operator!=(int32_t other) const { return num != uint32_t(other); } constexpr bool operator==(const FourCC& other) const { return num == other.num; }
bool operator==(uint32_t other) const { return num == other; } constexpr bool operator!=(const FourCC& other) const { return !operator==(other); }
bool operator!=(uint32_t other) const { return num != other; } constexpr bool operator==(const char* other) const {
std::string toString() const { return std::string(fcc, 4); } return other[0] == fcc[0] && other[1] == fcc[1] && other[2] == fcc[2] && other[3] == fcc[3];
uint32_t toUint32() const { return num; } }
const char* getChars() const { return fcc; } constexpr bool operator!=(const char* other) const { return !operator==(other); }
char* getChars() { return fcc; } constexpr bool operator==(int32_t other) const { return num == uint32_t(other); }
bool IsValid() const { return num != 0; } constexpr bool operator!=(int32_t other) const { return !operator==(other); }
constexpr bool operator==(uint32_t other) const { return num == other; }
constexpr bool operator!=(uint32_t other) const { return !operator==(other); }
std::string toString() const { return std::string(std::begin(fcc), std::end(fcc)); }
constexpr uint32_t toUint32() const { return num; }
constexpr const char* getChars() const { return fcc; }
constexpr char* getChars() { return fcc; }
constexpr bool IsValid() const { return num != 0; }
}; };
#define FOURCC(chars) FourCC(SBIG(chars)) #define FOURCC(chars) FourCC(SBIG(chars))
@ -55,25 +63,25 @@ public:
AT_DECL_EXPLICIT_DNA_YAML AT_DECL_EXPLICIT_DNA_YAML
}; };
template <> template <>
inline void DNAFourCC::Enumerate<BigDNA::Read>(typename Read::StreamT& r) { inline void DNAFourCC::Enumerate<BigDNA::Read>(Read::StreamT& r) {
r.readUBytesToBuf(fcc, 4); r.readUBytesToBuf(fcc, std::size(fcc));
} }
template <> template <>
inline void DNAFourCC::Enumerate<BigDNA::Write>(typename Write::StreamT& w) { inline void DNAFourCC::Enumerate<BigDNA::Write>(Write::StreamT& w) {
w.writeUBytes((atUint8*)fcc, 4); w.writeBytes(fcc, std::size(fcc));
} }
template <> template <>
inline void DNAFourCC::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r) { inline void DNAFourCC::Enumerate<BigDNA::ReadYaml>(ReadYaml::StreamT& r) {
std::string rs = r.readString(nullptr); const std::string rs = r.readString(nullptr);
strncpy(fcc, rs.c_str(), 4); rs.copy(fcc, std::size(fcc));
} }
template <> template <>
inline void DNAFourCC::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w) { inline void DNAFourCC::Enumerate<BigDNA::WriteYaml>(WriteYaml::StreamT& w) {
w.writeString(nullptr, std::string(fcc, 4)); w.writeString(nullptr, std::string_view{fcc, std::size(fcc)});
} }
template <> template <>
inline void DNAFourCC::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s) { inline void DNAFourCC::Enumerate<BigDNA::BinarySize>(BinarySize::StreamT& s) {
s += 4; s += std::size(fcc);
} }
} // namespace hecl } // namespace hecl
@ -85,7 +93,7 @@ struct hash<hecl::FourCC> {
}; };
} // namespace std } // namespace std
FMT_CUSTOM_FORMATTER(hecl::FourCC, "{:c}{:c}{:c}{:c}", FMT_CUSTOM_FORMATTER(hecl::FourCC, "{:c}{:c}{:c}{:c}", obj.getChars()[0], obj.getChars()[1], obj.getChars()[2],
obj.getChars()[0], obj.getChars()[1], obj.getChars()[2], obj.getChars()[3]) obj.getChars()[3])
FMT_CUSTOM_FORMATTER(hecl::DNAFourCC, "{:c}{:c}{:c}{:c}", FMT_CUSTOM_FORMATTER(hecl::DNAFourCC, "{:c}{:c}{:c}{:c}", obj.getChars()[0], obj.getChars()[1], obj.getChars()[2],
obj.getChars()[0], obj.getChars()[1], obj.getChars()[2], obj.getChars()[3]) obj.getChars()[3])

View File

@ -26,7 +26,6 @@ namespace hecl {
#if HECL_UCS2 #if HECL_UCS2
typedef wchar_t SystemChar; typedef wchar_t SystemChar;
static inline size_t StrLen(const SystemChar* str) { return wcslen(str); }
typedef std::wstring SystemString; typedef std::wstring SystemString;
typedef std::wstring_view SystemStringView; typedef std::wstring_view SystemStringView;
static inline void ToLower(SystemString& str) { std::transform(str.begin(), str.end(), str.begin(), towlower); } static inline void ToLower(SystemString& str) { std::transform(str.begin(), str.end(), str.begin(), towlower); }
@ -37,15 +36,22 @@ static inline void ToUpper(SystemString& str) { std::transform(str.begin(), str.
typedef struct _stat Sstat; typedef struct _stat Sstat;
#else #else
typedef char SystemChar; typedef char SystemChar;
static inline size_t StrLen(const SystemChar* str) { return strlen(str); }
typedef std::string SystemString; typedef std::string SystemString;
typedef std::string_view SystemStringView; typedef std::string_view SystemStringView;
static inline void ToLower(SystemString& str) { std::transform(str.begin(), str.end(), str.begin(), tolower); } static inline void ToLower(SystemString& str) {
static inline void ToUpper(SystemString& str) { std::transform(str.begin(), str.end(), str.begin(), toupper); } std::transform(str.begin(), str.end(), str.begin(),
[](SystemChar c) { return std::tolower(static_cast<unsigned char>(c)); });
}
static inline void ToUpper(SystemString& str) {
std::transform(str.begin(), str.end(), str.begin(),
[](SystemChar c) { return std::toupper(static_cast<unsigned char>(c)); });
}
#ifndef _SYS_STR #ifndef _SYS_STR
#define _SYS_STR(val) val #define _SYS_STR(val) val
#endif #endif
typedef struct stat Sstat; typedef struct stat Sstat;
#endif #endif
constexpr size_t StrLen(const SystemChar* str) { return std::char_traits<SystemChar>::length(str); }
} // namespace hecl } // namespace hecl

View File

@ -22,20 +22,22 @@ extern "C" int rep_closefrom(int lower);
#endif #endif
#include <Windows.h> #include <Windows.h>
#include <cwchar> #include <cwchar>
#include <cwctype>
#include <Shlwapi.h> #include <Shlwapi.h>
#include "winsupport.hpp" #include "winsupport.hpp"
#endif #endif
#include <algorithm>
#include <cinttypes> #include <cinttypes>
#include <ctime>
#include <cstdarg> #include <cstdarg>
#include <cstdio> #include <cstdio>
#include <ctime>
#include <functional> #include <functional>
#include <string>
#include <algorithm>
#include <regex>
#include <list> #include <list>
#include <map> #include <map>
#include <regex>
#include <string>
#include "logvisor/logvisor.hpp" #include "logvisor/logvisor.hpp"
#include "athena/Global.hpp" #include "athena/Global.hpp"
#include "../extern/boo/xxhash/xxhash.h" #include "../extern/boo/xxhash/xxhash.h"
@ -109,46 +111,66 @@ class SystemUTF8Conv {
public: public:
explicit SystemUTF8Conv(SystemStringView str) : m_utf8(WideToUTF8(str)) {} explicit SystemUTF8Conv(SystemStringView str) : m_utf8(WideToUTF8(str)) {}
std::string_view str() const { return m_utf8; } std::string_view str() const { return m_utf8; }
const char* c_str() const { return m_utf8.c_str(); } const char* c_str() const { return m_utf8.c_str(); }
std::string operator+(std::string_view other) const { return m_utf8 + other.data(); }
friend std::string operator+(const SystemUTF8Conv& lhs, std::string_view rhs) { return lhs.m_utf8 + rhs.data(); }
friend std::string operator+(std::string_view lhs, const SystemUTF8Conv& rhs) {
return std::string(lhs).append(rhs.m_utf8);
}
}; };
inline std::string operator+(std::string_view lhs, const SystemUTF8Conv& rhs) { return std::string(lhs) + rhs.c_str(); }
class SystemStringConv { class SystemStringConv {
std::wstring m_sys; std::wstring m_sys;
public: public:
explicit SystemStringConv(std::string_view str) : m_sys(UTF8ToWide(str)) {} explicit SystemStringConv(std::string_view str) : m_sys(UTF8ToWide(str)) {}
SystemStringView sys_str() const { return m_sys; } SystemStringView sys_str() const { return m_sys; }
const SystemChar* c_str() const { return m_sys.c_str(); } const SystemChar* c_str() const { return m_sys.c_str(); }
std::wstring operator+(const std::wstring_view other) const { return m_sys + other.data(); }
}; friend std::wstring operator+(const SystemStringConv& lhs, const std::wstring_view rhs) {
inline std::wstring operator+(std::wstring_view lhs, const SystemStringConv& rhs) { return lhs.m_sys + rhs.data();
return std::wstring(lhs) + rhs.c_str();
} }
friend std::wstring operator+(std::wstring_view lhs, const SystemStringConv& rhs) {
return std::wstring(lhs).append(rhs.m_sys);
}
};
#else #else
class SystemUTF8Conv { class SystemUTF8Conv {
std::string_view m_utf8; std::string_view m_utf8;
public: public:
explicit SystemUTF8Conv(SystemStringView str) : m_utf8(str) {} explicit SystemUTF8Conv(SystemStringView str) : m_utf8(str) {}
std::string_view str() const { return m_utf8; } std::string_view str() const { return m_utf8; }
const char* c_str() const { return m_utf8.data(); } const char* c_str() const { return m_utf8.data(); }
std::string operator+(std::string_view other) const { return std::string(m_utf8) + other.data(); }
friend std::string operator+(const SystemUTF8Conv& lhs, std::string_view rhs) {
return std::string(lhs.m_utf8).append(rhs);
}
friend std::string operator+(std::string_view lhs, const SystemUTF8Conv& rhs) {
return std::string(lhs).append(rhs.m_utf8);
}
}; };
inline std::string operator+(std::string_view lhs, const SystemUTF8Conv& rhs) { return std::string(lhs) + rhs.c_str(); }
class SystemStringConv { class SystemStringConv {
std::string_view m_sys; std::string_view m_sys;
public: public:
explicit SystemStringConv(std::string_view str) : m_sys(str) {} explicit SystemStringConv(std::string_view str) : m_sys(str) {}
SystemStringView sys_str() const { return m_sys; } SystemStringView sys_str() const { return m_sys; }
const SystemChar* c_str() const { return m_sys.data(); } const SystemChar* c_str() const { return m_sys.data(); }
std::string operator+(std::string_view other) const { return std::string(m_sys) + other.data(); }
}; friend std::string operator+(const SystemStringConv& lhs, std::string_view rhs) {
inline std::string operator+(std::string_view lhs, const SystemStringConv& rhs) { return std::string(lhs.m_sys).append(rhs);
return std::string(lhs) + rhs.c_str();
} }
friend std::string operator+(std::string_view lhs, const SystemStringConv& rhs) {
return std::string(lhs).append(rhs.m_sys);
}
};
#endif #endif
void SanitizePath(std::string& path); void SanitizePath(std::string& path);
@ -309,11 +331,8 @@ inline int StrCmp(const SystemChar* str1, const SystemChar* str2) {
inline int StrNCmp(const SystemChar* str1, const SystemChar* str2, size_t count) { inline int StrNCmp(const SystemChar* str1, const SystemChar* str2, size_t count) {
if (!str1 || !str2) if (!str1 || !str2)
return str1 != str2; return str1 != str2;
#if HECL_UCS2
return wcsncmp(str1, str2, count); return std::char_traits<SystemChar>::compare(str1, str2, count);
#else
return strncmp(str1, str2, count);
#endif
} }
inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2) { inline int StrCaseCmp(const SystemChar* str1, const SystemChar* str2) {
@ -391,13 +410,12 @@ inline int ConsoleWidth(bool* ok = nullptr) {
} }
class MultiProgressPrinter; class MultiProgressPrinter;
typedef std::basic_regex<SystemChar> SystemRegex;
typedef std::regex_token_iterator<SystemString::const_iterator> SystemRegexTokenIterator;
typedef std::match_results<SystemString::const_iterator> SystemRegexMatch;
class ProjectRootPath; class ProjectRootPath;
using SystemRegex = std::basic_regex<SystemChar>;
using SystemRegexMatch = std::match_results<SystemString::const_iterator>;
using SystemRegexTokenIterator = std::regex_token_iterator<SystemString::const_iterator>;
/** /**
* @brief Hash representation used for all storable and comparable objects * @brief Hash representation used for all storable and comparable objects
* *
@ -409,35 +427,36 @@ protected:
uint64_t hash = 0; uint64_t hash = 0;
public: public:
Hash() = default; constexpr Hash() = default;
operator bool() const { return hash != 0; } constexpr Hash(const Hash&) = default;
Hash(const void* buf, size_t len) : hash(XXH64((uint8_t*)buf, len, 0)) {} constexpr Hash(Hash&&) noexcept = default;
Hash(std::string_view str) : hash(XXH64((uint8_t*)str.data(), str.size(), 0)) {} constexpr Hash(uint64_t hashin) : hash(hashin) {}
Hash(std::wstring_view str) : hash(XXH64((uint8_t*)str.data(), str.size() * 2, 0)) {} explicit Hash(const void* buf, size_t len) : hash(XXH64((uint8_t*)buf, len, 0)) {}
Hash(uint64_t hashin) : hash(hashin) {} explicit Hash(std::string_view str) : hash(XXH64((uint8_t*)str.data(), str.size(), 0)) {}
Hash(const Hash& other) { hash = other.hash; } explicit Hash(std::wstring_view str) : hash(XXH64((uint8_t*)str.data(), str.size() * 2, 0)) {}
uint32_t val32() const { return uint32_t(hash) ^ uint32_t(hash >> 32); }
uint64_t val64() const { return uint64_t(hash); } constexpr uint32_t val32() const { return uint32_t(hash) ^ uint32_t(hash >> 32); }
size_t valSizeT() const { return size_t(hash); } constexpr uint64_t val64() const { return uint64_t(hash); }
constexpr size_t valSizeT() const { return size_t(hash); }
template <typename T> template <typename T>
T valT() const; constexpr T valT() const;
Hash& operator=(const Hash& other) {
hash = other.hash; constexpr Hash& operator=(const Hash& other) = default;
return *this; constexpr Hash& operator=(Hash&& other) noexcept = default;
} constexpr bool operator==(const Hash& other) const { return hash == other.hash; }
bool operator==(const Hash& other) const { return hash == other.hash; } constexpr bool operator!=(const Hash& other) const { return hash != other.hash; }
bool operator!=(const Hash& other) const { return hash != other.hash; } constexpr bool operator<(const Hash& other) const { return hash < other.hash; }
bool operator<(const Hash& other) const { return hash < other.hash; } constexpr bool operator>(const Hash& other) const { return hash > other.hash; }
bool operator>(const Hash& other) const { return hash > other.hash; } constexpr bool operator<=(const Hash& other) const { return hash <= other.hash; }
bool operator<=(const Hash& other) const { return hash <= other.hash; } constexpr bool operator>=(const Hash& other) const { return hash >= other.hash; }
bool operator>=(const Hash& other) const { return hash >= other.hash; } constexpr explicit operator bool() const { return hash != 0; }
}; };
template <> template <>
inline uint32_t Hash::valT<uint32_t>() const { constexpr uint32_t Hash::valT<uint32_t>() const {
return val32(); return val32();
} }
template <> template <>
inline uint64_t Hash::valT<uint64_t>() const { constexpr uint64_t Hash::valT<uint64_t>() const {
return val64(); return val64();
} }
@ -469,20 +488,16 @@ public:
*/ */
struct CaseInsensitiveCompare { struct CaseInsensitiveCompare {
bool operator()(std::string_view lhs, std::string_view rhs) const { bool operator()(std::string_view lhs, std::string_view rhs) const {
#if _WIN32 return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), [](char lhs, char rhs) {
if (_stricmp(lhs.data(), rhs.data()) < 0) return std::tolower(static_cast<unsigned char>(lhs)) < std::tolower(static_cast<unsigned char>(rhs));
#else });
if (strcasecmp(lhs.data(), rhs.data()) < 0)
#endif
return true;
return false;
} }
#if _WIN32 #if _WIN32
bool operator()(std::wstring_view lhs, std::wstring_view rhs) const { bool operator()(std::wstring_view lhs, std::wstring_view rhs) const {
if (_wcsicmp(lhs.data(), rhs.data()) < 0) return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), [](wchar_t lhs, wchar_t rhs) {
return true; return std::towlower(lhs) < std::towlower(rhs);
return false; });
} }
#endif #endif
}; };
@ -499,8 +514,8 @@ public:
size_t m_fileSz; size_t m_fileSz;
bool m_isDir; bool m_isDir;
Entry(const hecl::SystemString& path, const hecl::SystemChar* name, size_t sz, bool isDir) Entry(hecl::SystemString path, const hecl::SystemChar* name, size_t sz, bool isDir)
: m_path(path), m_name(name), m_fileSz(sz), m_isDir(isDir) {} : m_path(std::move(path)), m_name(name), m_fileSz(sz), m_isDir(isDir) {}
}; };
private: private:
@ -577,7 +592,8 @@ public:
return SystemString(beginIt, absPathForward.cend()); return SystemString(beginIt, absPathForward.cend());
} }
} }
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}' as project relative '{}'")), absPath, m_projRoot); LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}' as project relative '{}'")), absPath,
m_projRoot);
return SystemString(); return SystemString();
} }
@ -1039,21 +1055,21 @@ public:
static bool BeginsWith(SystemStringView str, SystemStringView test) { static bool BeginsWith(SystemStringView str, SystemStringView test) {
if (test.size() > str.size()) if (test.size() > str.size())
return false; return false;
return !StrNCmp(str.data(), test.data(), test.size()); return str.compare(0, test.size(), test) == 0;
} }
static bool EndsWith(SystemStringView str, SystemStringView test) { static bool EndsWith(SystemStringView str, SystemStringView test) {
if (test.size() > str.size()) if (test.size() > str.size())
return false; return false;
return !StrNCmp(&*(str.end() - test.size()), test.data(), test.size()); return str.compare(str.size() - test.size(), SystemStringView::npos, test) == 0;
} }
static std::string TrimWhitespace(std::string_view str) { static std::string TrimWhitespace(std::string_view str) {
auto bit = str.begin(); auto bit = str.begin();
while (bit != str.cend() && isspace(*bit)) while (bit != str.cend() && std::isspace(static_cast<unsigned char>(*bit)))
++bit; ++bit;
auto eit = str.end(); auto eit = str.end();
while (eit != str.cbegin() && isspace(*(eit - 1))) while (eit != str.cbegin() && std::isspace(static_cast<unsigned char>(*(eit - 1))))
--eit; --eit;
return {bit, eit}; return {bit, eit};
} }
@ -1062,21 +1078,21 @@ public:
static bool BeginsWith(std::string_view str, std::string_view test) { static bool BeginsWith(std::string_view str, std::string_view test) {
if (test.size() > str.size()) if (test.size() > str.size())
return false; return false;
return !strncmp(str.data(), test.data(), test.size()); return str.compare(0, test.size(), test) == 0;
} }
static bool EndsWith(std::string_view str, std::string_view test) { static bool EndsWith(std::string_view str, std::string_view test) {
if (test.size() > str.size()) if (test.size() > str.size())
return false; return false;
return !strncmp(&*(str.end() - test.size()), test.data(), test.size()); return str.compare(str.size() - test.size(), std::string_view::npos, test) == 0;
} }
static SystemString TrimWhitespace(SystemStringView str) { static SystemString TrimWhitespace(SystemStringView str) {
auto bit = str.begin(); auto bit = str.begin();
while (bit != str.cend() && iswspace(*bit)) while (bit != str.cend() && std::iswspace(*bit))
++bit; ++bit;
auto eit = str.end(); auto eit = str.end();
while (eit != str.cbegin() && iswspace(*(eit - 1))) while (eit != str.cbegin() && std::iswspace(*(eit - 1)))
--eit; --eit;
return {bit, eit}; return {bit, eit};
} }
@ -1095,9 +1111,9 @@ class ResourceLock {
bool good; bool good;
public: public:
operator bool() const { return good; } explicit operator bool() const { return good; }
static bool InProgress(const ProjectPath& path); static bool InProgress(const ProjectPath& path);
ResourceLock(const ProjectPath& path) { good = SetThreadRes(path); } explicit ResourceLock(const ProjectPath& path) : good{SetThreadRes(path)} {}
~ResourceLock() { ~ResourceLock() {
if (good) if (good)
ClearThreadRes(); ClearThreadRes();
@ -1195,13 +1211,25 @@ constexpr uint32_t SBig(uint32_t val) { return bswap32(val); }
constexpr int64_t SBig(int64_t val) { return bswap64(val); } constexpr int64_t SBig(int64_t val) { return bswap64(val); }
constexpr uint64_t SBig(uint64_t val) { return bswap64(val); } constexpr uint64_t SBig(uint64_t val) { return bswap64(val); }
constexpr float SBig(float val) { constexpr float SBig(float val) {
union { float f; atInt32 i; } uval1 = {val}; union {
union { atInt32 i; float f; } uval2 = {bswap32(uval1.i)}; float f;
atInt32 i;
} uval1 = {val};
union {
atInt32 i;
float f;
} uval2 = {bswap32(uval1.i)};
return uval2.f; return uval2.f;
} }
constexpr double SBig(double val) { constexpr double SBig(double val) {
union { double f; atInt64 i; } uval1 = {val}; union {
union { atInt64 i; double f; } uval2 = {bswap64(uval1.i)}; double f;
atInt64 i;
} uval1 = {val};
union {
atInt64 i;
double f;
} uval2 = {bswap64(uval1.i)};
return uval2.f; return uval2.f;
} }
#ifndef SBIG #ifndef SBIG

View File

@ -17,7 +17,7 @@
namespace hecl::Database { namespace hecl::Database {
logvisor::Module LogModule("hecl::Database"); logvisor::Module LogModule("hecl::Database");
static const hecl::FourCC HECLfcc("HECL"); constexpr hecl::FourCC HECLfcc("HECL");
/********************************************** /**********************************************
* Project::ConfigFile * Project::ConfigFile

View File

@ -264,7 +264,7 @@ ProjectRootPath SearchForProject(SystemStringView path) {
fclose(fp); fclose(fp);
if (readSize != 4) if (readSize != 4)
continue; continue;
static const hecl::FourCC hecl("HECL"); static constexpr hecl::FourCC hecl("HECL");
if (hecl::FourCC(magic) != hecl) if (hecl::FourCC(magic) != hecl)
continue; continue;
return ProjectRootPath(testPath); return ProjectRootPath(testPath);