mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Fixed [NSProcessInfo -processName] and updated places that used it.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4809 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
728ed7b08b
commit
818b4aad92
4 changed files with 38 additions and 28 deletions
|
@ -312,7 +312,7 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
|||
char *output;
|
||||
NSString *path, *s;
|
||||
|
||||
path = [[NSProcessInfo processInfo] processName];
|
||||
path = [[[NSProcessInfo processInfo] arguments] objectAtIndex: 0];
|
||||
output = objc_find_executable([path cString]);
|
||||
NSAssert(output, NSInternalInconsistencyException);
|
||||
path = [NSString stringWithCString: output];
|
||||
|
|
|
@ -109,7 +109,7 @@ NSLogv (NSString* format, va_list args)
|
|||
stringWithFormat: @"%@ %@[%d] ",
|
||||
[[NSCalendarDate calendarDate]
|
||||
descriptionWithCalendarFormat: @"%b %d %H:%M:%S"],
|
||||
[[[NSProcessInfo processInfo] processName] lastPathComponent],
|
||||
[[NSProcessInfo processInfo] processName],
|
||||
pid];
|
||||
|
||||
/* Check if there is already a newline at the end of the format */
|
||||
|
|
|
@ -157,7 +157,8 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
int i;
|
||||
|
||||
/* Getting the process name */
|
||||
_gnu_processName = [[NSString alloc] initWithCString: argv[0]];
|
||||
_gnu_processName = [[NSString stringWithCString: argv[0]] lastPathComponent];
|
||||
RETAIN(_gnu_processName);
|
||||
|
||||
/* Copy the argument list */
|
||||
{
|
||||
|
|
|
@ -326,8 +326,7 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
RETAIN([NSDistributedLock lockWithPath: defaultsDatabaseLockName]);
|
||||
}
|
||||
if (processName == nil)
|
||||
processName = RETAIN([[[NSProcessInfo processInfo] processName]
|
||||
lastPathComponent]);
|
||||
processName = RETAIN([[NSProcessInfo processInfo] processName]);
|
||||
|
||||
// Create an empty search list
|
||||
searchList = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
|
@ -901,31 +900,41 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
|
||||
while (!done)
|
||||
{
|
||||
if ([key hasPrefix: @"-"]) {
|
||||
/* anything beginning with a '-' is a defaults key and we must strip
|
||||
the '-' from it. As a special case, we leave the '- in place
|
||||
for '-GS...' and '--GS...' for backward compatibility. */
|
||||
if ([key hasPrefix: @"-GS"] == NO && [key hasPrefix: @"--GS"] == NO) {
|
||||
if ([key hasPrefix: @"-"])
|
||||
{
|
||||
NSString *old = nil;
|
||||
/* anything beginning with a '-' is a defaults key and we must strip
|
||||
the '-' from it. As a special case, we leave the '- in place
|
||||
for '-GS...' and '--GS...' for backward compatibility. */
|
||||
if ([key hasPrefix: @"-GS"] == YES || [key hasPrefix: @"--GS"] == YES)
|
||||
{
|
||||
old = key;
|
||||
}
|
||||
key = [key substringFromIndex: 1];
|
||||
val = [enumerator nextObject];
|
||||
if (!val)
|
||||
{ // No more args
|
||||
[argDict setObject: @"" forKey: key]; // arg is empty.
|
||||
if (old)
|
||||
[argDict setObject: @"" forKey: old];
|
||||
done = YES;
|
||||
continue;
|
||||
}
|
||||
else if ([val hasPrefix: @"-"])
|
||||
{ // Yet another argument
|
||||
[argDict setObject: @"" forKey: key]; // arg is empty.
|
||||
if (old)
|
||||
[argDict setObject: @"" forKey: old];
|
||||
key = val;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{ // Real parameter
|
||||
[argDict setObject: val forKey: key];
|
||||
if (old)
|
||||
[argDict setObject: val forKey: old];
|
||||
}
|
||||
}
|
||||
val = [enumerator nextObject];
|
||||
if (!val)
|
||||
{ // No more args
|
||||
[argDict setObject: @"" forKey: key]; // arg is empty.
|
||||
done = YES;
|
||||
continue;
|
||||
}
|
||||
else if ([val hasPrefix: @"-"])
|
||||
{ // Yet another argument
|
||||
[argDict setObject: @"" forKey: key]; // arg is empty.
|
||||
key = val;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{ // Real parameter
|
||||
[argDict setObject: val forKey: key];
|
||||
}
|
||||
}
|
||||
done = ((key = [enumerator nextObject]) == nil);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue