From a75d1c7b18ecae6a2410cad885f5ca4e9b7f178c Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 6 Dec 2024 10:58:15 +0000 Subject: [PATCH] Add diagnositcs for faulure to get executable pathhhhhhhhhhhhhhhhhhhhhhhhh --- Source/NSBundle.m | 36 ++++++++++++++++++++++++++++++++---- Source/NSUserDefaults.m | 5 +++-- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Source/NSBundle.m b/Source/NSBundle.m index 37fb8ec2e..57beb7700 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -358,6 +358,8 @@ GSPrivateExecutablePath() [load_lock lock]; if (beenHere == NO) { + NSString *tmp; + #if defined(PROCFS_EXE_LINK) executablePath = [manager() pathContentOfSymbolicLinkAtPath: @@ -376,19 +378,45 @@ GSPrivateExecutablePath() executablePath = nil; } #endif - if (executablePath == nil || [executablePath length] == 0) + if ([executablePath length] == 0) { executablePath = [[[NSProcessInfo processInfo] arguments] objectAtIndex: 0]; + if ([executablePath length] == 0) + { + fprintf(stderr, + "Unable to get executable path from NSProcessInfo.\n"); + } } if (NO == [executablePath isAbsolutePath]) { - executablePath = AbsolutePathOfExecutable(executablePath, YES); + tmp = executablePath; + executablePath = AbsolutePathOfExecutable(tmp, YES); + if ([executablePath length] == 0) + { + fprintf(stderr, + "Unable to get absolute value of executable path '%s'.\n", + [tmp UTF8String]); + } } else { - executablePath = [executablePath stringByResolvingSymlinksInPath]; - executablePath = [executablePath stringByStandardizingPath]; + tmp = executablePath; + executablePath = [tmp stringByResolvingSymlinksInPath]; + if ([executablePath length] == 0) + { + fprintf(stderr, + "Unable to get resolve links in executable path '%s'.\n", + [tmp UTF8String]); + } + tmp = executablePath; + executablePath = [tmp stringByStandardizingPath]; + if ([executablePath length] == 0) + { + fprintf(stderr, + "Unable to standardize executable path '%s'.\n", + [tmp UTF8String]); + } } IF_NO_ARC([executablePath retain];) beenHere = YES; diff --git a/Source/NSUserDefaults.m b/Source/NSUserDefaults.m index 7747fac67..ee000a38e 100644 --- a/Source/NSUserDefaults.m +++ b/Source/NSUserDefaults.m @@ -2345,8 +2345,9 @@ GSPrivateDefaultsFlag(GSUserDefaultFlagType type) { if (initializing) { - fprintf(stderr, "GSPrivateDefaultsFlag() called within" - " +[NSUserDefaults initialize] always returns NO.\n"); + fprintf(stderr, "GSPrivateDefaultsFlag(%d) called within" + " +[NSUserDefaults initialize] always returns NO.\n", + (int)type); } else {