Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide definitions for macros in rootless.h when !TARGET_OS_IPHONE #97

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions rootless.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#include <TargetConditionals.h>

#if TARGET_OS_IPHONE

#include <libroot/libroot.h>

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

#define ROOT_PATH_NS(nsPath) JBROOT_PATH_NSSTRING(nsPath)
#define ROOT_PATH_NS_VAR(nsPath) JBROOT_PATH_NSSTRING(nsPath)

#else

// no libroot support

#include <sys/syslimits.h>
#include <string.h>

#define ROOT_PATH(cPath) THEOS_PACKAGE_INSTALL_PREFIX cPath
#define ROOT_PATH_NS(path) @THEOS_PACKAGE_INSTALL_PREFIX path

#define ROOT_PATH_NS_VAR(path) [@THEOS_PACKAGE_INSTALL_PREFIX stringByAppendingPathComponent:path]
#define ROOT_PATH_VAR(path) sizeof(THEOS_PACKAGE_INSTALL_PREFIX) > 1 ? ({ \
char outPath[PATH_MAX]; \
strlcpy(outPath, THEOS_PACKAGE_INSTALL_PREFIX, PATH_MAX); \
strlcat(outPath, path, PATH_MAX); \
outPath; \
}) : path

#endif