Skip to content

Commit 322c069

Browse files
authored
[rootless] Provide macro definitions when !TARGET_OS_IPHONE (#97)
These definitions should not rely on libroot which is currently only available for iOS. This uses the definitions that were previously used in a2a4086
1 parent 8194da1 commit 322c069

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

rootless.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#include <TargetConditionals.h>
2+
3+
#if TARGET_OS_IPHONE
4+
15
#include <libroot/libroot.h>
26

37
#ifdef XINA_SUPPORT
@@ -9,3 +13,23 @@ _Pragma("message(\"'XINA_SUPPORT' is deprecated. libroot will now handle this fo
913

1014
#define ROOT_PATH_NS(nsPath) JBROOT_PATH_NSSTRING(nsPath)
1115
#define ROOT_PATH_NS_VAR(nsPath) JBROOT_PATH_NSSTRING(nsPath)
16+
17+
#else
18+
19+
// no libroot support
20+
21+
#include <sys/syslimits.h>
22+
#include <string.h>
23+
24+
#define ROOT_PATH(cPath) THEOS_PACKAGE_INSTALL_PREFIX cPath
25+
#define ROOT_PATH_NS(path) @THEOS_PACKAGE_INSTALL_PREFIX path
26+
27+
#define ROOT_PATH_NS_VAR(path) [@THEOS_PACKAGE_INSTALL_PREFIX stringByAppendingPathComponent:path]
28+
#define ROOT_PATH_VAR(path) sizeof(THEOS_PACKAGE_INSTALL_PREFIX) > 1 ? ({ \
29+
char outPath[PATH_MAX]; \
30+
strlcpy(outPath, THEOS_PACKAGE_INSTALL_PREFIX, PATH_MAX); \
31+
strlcat(outPath, path, PATH_MAX); \
32+
outPath; \
33+
}) : path
34+
35+
#endif

0 commit comments

Comments
 (0)