diff --git a/Source/NSDistributedNotificationCenter.m b/Source/NSDistributedNotificationCenter.m index 0606643c2..ee88c9cbd 100644 --- a/Source/NSDistributedNotificationCenter.m +++ b/Source/NSDistributedNotificationCenter.m @@ -44,6 +44,7 @@ #import "Foundation/NSPortNameServer.h" #import "Foundation/NSDebug.h" #import "Foundation/NSThread.h" +#import "GNUstepBase/GSCategories.h" #import "../Tools/gdnc.h" @@ -695,22 +696,8 @@ static NSDistributedNotificationCenter *netCenter = nil; NSString *cmd = nil; NSArray *args = nil; NSDate *limit; - NSEnumerator *enumerator; - NSString *path; - NSFileManager *mgr; - mgr = [NSFileManager defaultManager]; - enumerator = [NSSearchPathForDirectoriesInDomains( - GSToolsDirectory, NSAllDomainsMask, YES) objectEnumerator]; - while ((path = [enumerator nextObject]) != nil) - { - path = [path stringByAppendingPathComponent: @"gdnc"]; - if ([mgr isExecutableFileAtPath: path]) - { - cmd = path; - break; - } - } + cmd = [NSTask launchPathForTool: @"gdnc"]; NSDebugMLLog(@"NSDistributedNotificationCenter", @"\nI couldn't contact the notification server for %@ -\n" diff --git a/Source/NSSocketPortNameServer.m b/Source/NSSocketPortNameServer.m index 1e48c1108..419c94e7b 100644 --- a/Source/NSSocketPortNameServer.m +++ b/Source/NSSocketPortNameServer.m @@ -46,6 +46,7 @@ #import "Foundation/NSPathUtilities.h" #import "Foundation/NSPortNameServer.h" #import "Foundation/NSDebug.h" +#import "GNUstepBase/GSCategories.h" #import "GSPortPrivate.h" @@ -187,22 +188,7 @@ typedef enum { [self close]; if (launchCmd == nil) { - NSEnumerator *enumerator; - NSString *path; - NSFileManager *mgr; - - mgr = [NSFileManager defaultManager]; - enumerator = [NSSearchPathForDirectoriesInDomains( - GSToolsDirectory, NSAllDomainsMask, YES) objectEnumerator]; - while ((path = [enumerator nextObject]) != nil) - { - path = [path stringByAppendingPathComponent: @"gdomap"]; - if ([mgr isExecutableFileAtPath: path]) - { - launchCmd = [path copy]; - break; - } - } + launchCmd = [NSTask launchPathForTool: @"gdomap"]; } if (state == GSPC_LOPEN && launchCmd != nil) {