mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
move executable extensions code out to NSTask+GNUstepBase.m to avoid duplication
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37590 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e92bfba565
commit
f8006295b0
5 changed files with 93 additions and 93 deletions
|
@ -62,6 +62,7 @@
|
|||
#import "Foundation/NSValue.h"
|
||||
#import "GSPrivate.h"
|
||||
#import "GNUstepBase/NSString+GNUstepBase.h"
|
||||
#import "GNUstepBase/NSTask+GNUstepBase.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -1670,36 +1671,7 @@ static NSStringEncoding defaultEncoding;
|
|||
|
||||
if (nil == executable)
|
||||
{
|
||||
NSMutableSet *m;
|
||||
NSEnumerator *e;
|
||||
NSString *s;
|
||||
|
||||
/* Get PATHEXT environment variable and split apart on ';'
|
||||
*/
|
||||
e = [[[[[NSProcessInfo processInfo] environment]
|
||||
objectForKey: @"PATHEXT"]
|
||||
componentsSeparatedByString: @";"] objectEnumerator];
|
||||
|
||||
m = [NSMutableSet set];
|
||||
while (nil != (s = [e nextObject]))
|
||||
{
|
||||
/* We don't have a '.' in a file extension, but the
|
||||
* environment variable probably does ... fix it.
|
||||
*/
|
||||
s = [s stringByTrimmingSpaces];
|
||||
if ([s hasPrefix: @"."])
|
||||
{
|
||||
s = [s substringFromIndex: 1];
|
||||
}
|
||||
if ([s length] > 0)
|
||||
{
|
||||
[m addObject: s];
|
||||
}
|
||||
}
|
||||
/* Make sure we at least have the EXE extension.
|
||||
*/
|
||||
[m addObject: @"EXE"];
|
||||
ASSIGNCOPY(executable, m);
|
||||
executable = [[NSTask executableExtensions] copy];
|
||||
}
|
||||
if (nil != [executable member: ext])
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue