2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 20:27:43 +00:00

New code style refactor

This commit is contained in:
Jack Andersen
2018-12-07 19:18:42 -10:00
parent 54c466276b
commit 72193079ae
74 changed files with 14647 additions and 17058 deletions

View File

@@ -8,46 +8,43 @@
using namespace Windows::Storage;
#endif
namespace hecl::Runtime
{
namespace hecl::Runtime {
static logvisor::Module Log("FileStoreManager");
FileStoreManager::FileStoreManager(SystemStringView domain)
: m_domain(domain)
{
FileStoreManager::FileStoreManager(SystemStringView domain) : m_domain(domain) {
#if _WIN32
#if !WINDOWS_STORE
WCHAR home[MAX_PATH];
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
Log.report(logvisor::Fatal, _SYS_STR("unable to locate profile for file store"));
WCHAR home[MAX_PATH];
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
Log.report(logvisor::Fatal, _SYS_STR("unable to locate profile for file store"));
SystemString path(home);
SystemString path(home);
#else
StorageFolder^ cacheFolder = ApplicationData::Current->LocalCacheFolder;
SystemString path(cacheFolder->Path->Data());
StorageFolder ^ cacheFolder = ApplicationData::Current->LocalCacheFolder;
SystemString path(cacheFolder->Path->Data());
#endif
path += _SYS_STR("/.heclrun");
path += _SYS_STR("/.heclrun");
hecl::MakeDir(path.c_str());
path += _SYS_STR('/');
path += domain.data();
hecl::MakeDir(path.c_str());
path += _SYS_STR('/');
path += domain.data();
hecl::MakeDir(path.c_str());
m_storeRoot = path;
hecl::MakeDir(path.c_str());
m_storeRoot = path;
#else
const char* home = getenv("HOME");
if (!home)
Log.report(logvisor::Fatal, "unable to locate $HOME for file store");
std::string path(home);
path += "/.heclrun";
if (mkdir(path.c_str(), 0755) && errno != EEXIST)
Log.report(logvisor::Fatal, "unable to mkdir at %s", path.c_str());
path += '/';
path += domain.data();
if (mkdir(path.c_str(), 0755) && errno != EEXIST)
Log.report(logvisor::Fatal, "unable to mkdir at %s", path.c_str());
m_storeRoot = path;
const char* home = getenv("HOME");
if (!home)
Log.report(logvisor::Fatal, "unable to locate $HOME for file store");
std::string path(home);
path += "/.heclrun";
if (mkdir(path.c_str(), 0755) && errno != EEXIST)
Log.report(logvisor::Fatal, "unable to mkdir at %s", path.c_str());
path += '/';
path += domain.data();
if (mkdir(path.c_str(), 0755) && errno != EEXIST)
Log.report(logvisor::Fatal, "unable to mkdir at %s", path.c_str());
m_storeRoot = path;
#endif
}
}
} // namespace hecl::Runtime