flatten 20260225

This commit is contained in:
Timothy Prepscius
2026-02-25 12:39:24 -05:00
commit fa54be052a
315 changed files with 49791 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
// TJP COPYRIGHT HEADER
#include "Directories.h"
#include "../Path.h"
#include <tjp/core/system/System.h>
#ifdef SYS_MAC
#include <mach-o/dyld.h>
#include "CoreFoundation/CFBundle.h"
#endif
#ifdef SYS_IOS
#include <mach-o/dyld.h>
#include "CoreFoundation/CFBundle.h"
#endif
#include <stdlib.h>
namespace tjp {
namespace core {
namespace file {
namespace apple {
std::string getHomeDirectory ()
{
const char *homeDir = getenv("HOME");
if (homeDir)
return homeDir;
return {};
}
std::string getExecutablePath ()
{
char path_[PATH_MAX+1];
uint32_t size=PATH_MAX;
_NSGetExecutablePath(path_, &size);
if (size > 0)
{
auto path = std::string(path_);
return path;
}
return {};
}
std::string getExecutableDirectory ()
{
auto path = getExecutablePath();
return popFileName(path);
}
std::string getExecutableBundleDirectory ()
{
return popLast(getExecutableDirectory());
}
std::string getExecutableResourceDirectory ()
{
auto path = getExecutableBundleDirectory();
return joinDirs({ path, "Resources"});
}
} // namespace
} // namespace
} // namespace
} // namespace

View File

@@ -0,0 +1,22 @@
// TJP COPYRIGHT HEADER
#pragma once
#include <vector>
#include <string>
namespace tjp {
namespace core {
namespace file {
namespace apple {
std::string getExecutablePath();
std::string getExecutableDirectory();
std::string getExecutableBundleDirectory();
std::string getExecutableResourceDirectory();
std::string getHomeDirectory();
} // namespace
} // namespace
} // namespace
} // namespace