mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
fix(build): fix macOS compilation errors
This commit is contained in:
parent
b3ae2d1ebd
commit
efe062ca6b
2 changed files with 31 additions and 4 deletions
|
|
@ -5,12 +5,19 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_LINUX)
|
#if defined(WHOA_SYSTEM_LINUX)
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_MAC)
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <mach/mach_time.h>
|
#include <mach/mach_time.h>
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#include <sys/syslimits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -163,7 +170,25 @@ static const char* PrependDefaultDir(char* newfilename, uint32_t newfilenamesize
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_MAC)
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
// TODO: GetModuleFileName() for Mac implementation
|
newfilename[0] = '\0';
|
||||||
|
|
||||||
|
char path[PATH_MAX] = {0};
|
||||||
|
char actualPath[PATH_MAX] = {0};
|
||||||
|
uint32_t size = PATH_MAX;
|
||||||
|
if (_NSGetExecutablePath(path, &size) == 0) {
|
||||||
|
if (!realpath(path, actualPath)) {
|
||||||
|
actualPath[0] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char* slash = SStrChrR(actualPath, '/');
|
||||||
|
if (slash) {
|
||||||
|
slash[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
SStrCopy(newfilename, actualPath, newfilenamesize);
|
||||||
|
SStrPack(newfilename, "/", newfilenamesize);
|
||||||
|
SStrPack(newfilename, filename, newfilenamesize);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
#define STORM_LOG_HPP
|
#define STORM_LOG_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#include <cstdarg>
|
||||||
|
|
||||||
#include "storm/Common.hpp"
|
#include "storm/Common.hpp"
|
||||||
#include "storm/String.hpp"
|
#include "storm/String.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue