NSProcessInfo.m: (_gnu_process_args) fixed for recent mingw compilers.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22785 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
jbettis 2006-04-12 21:45:52 +00:00
parent 8992bc1d0c
commit 37999fc948

View file

@ -263,6 +263,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
/* Copy the argument list */
if (argv)
{
NSString *str;
NSMutableSet *mySet;
@ -291,6 +292,40 @@ _gnu_process_args(int argc, char *argv[], char *env[])
RELEASE(arg0);
}
#if defined(__MINGW32__)
// It appears that in some versions of mingw32 __argv is no longer supported
// However GetCommandLine always works. Perhaps this should be the default case
// as it is unicode.
else
{
unichar **argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
NSString *str;
NSMutableSet *mySet;
id obj_argv[argc];
int added = 1;
mySet = [NSMutableSet new];
/* Copy the zero'th argument to the argument list */
obj_argv[0] = arg0;
for (i = 1; i < argc; i++)
{
str = [NSString stringWithCharacters: argvw[i] length: wcslen(argvw[i])];
if ([str hasPrefix: @"--GNU-Debug="])
[mySet addObject: [str substringFromIndex: 12]];
else
obj_argv[added++] = str;
}
IF_NO_GC(RELEASE(_gnu_arguments));
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
IF_NO_GC(RELEASE(_debug_set));
_debug_set = mySet;
RELEASE(arg0);
}
#endif
/* Copy the evironment list */
{
NSMutableArray *keys = [NSMutableArray new];