From 08554b26551787bdbee24ed27a5ff0d9aea142f1 Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Wed, 14 Nov 2018 14:17:06 +1030 Subject: [PATCH] containerise symbolic link to servald.log file --- instance.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/instance.c b/instance.c index d83c0116..aebc9dc2 100644 --- a/instance.c +++ b/instance.c @@ -186,8 +186,21 @@ int _vformf_serval_run_path(struct __sourceloc __whence, char *buf, size_t bufsi strbuf strbuf_system_log_path(strbuf sb) { +char *base_path = SERVAL_LOG_PATH; + +#ifdef __APPLE__ +#ifdef TARGET_OS_IPHONE + // iOS device + char containerised_path[8192]; + if (getenv("HOME")) { + snprintf(containerised_path,8192,"%s/%s",getenv("HOME"),SERVAL_LOG_PATH); + base_path=containerised_path; + } +#endif +#endif + const char *ipath = instance_path(); - strbuf_puts(sb, ipath ? ipath : SYSTEM_LOG_PATH); + strbuf_puts(sb, ipath ? ipath : base_path); return sb; }