don't require msys/version prefix to developer area on mingw

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37596 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2014-01-13 16:32:12 +00:00
parent 76a99f8dbb
commit cc78018d45

View file

@ -2093,9 +2093,8 @@ NSOpenStepRootDirectory(void)
#if defined(__MINGW__) #if defined(__MINGW__)
/* The developer root on a windows system (where we have an msys environment /* The developer root on a windows system (where we have an msys environment
* set up) is the point in the filesystem where we can reference bin/make * set up) is the point in the filesystem where we can reference bin/make ...
* bin/make from msys/version ... a simple heuristic to let us find the * simple heuristic to let us find the native windows path to the msys root.
* native windows path to the msys root.
*/ */
static NSString* static NSString*
devroot(NSFileManager *manager, NSString *path) devroot(NSFileManager *manager, NSString *path)
@ -2104,9 +2103,35 @@ devroot(NSFileManager *manager, NSString *path)
while (NO == [tmp isEqual: path]) while (NO == [tmp isEqual: path])
{ {
NSString *pb;
pb = [path stringByAppendingPathComponent: @"bin/make.exe"];
if ([manager isExecutableFileAtPath: pb])
{
return path;
}
tmp = path;
path = [tmp stringByDeletingLastPathComponent];
}
return nil;
}
/* Like devroot(), but also checks for msys/version subdirectories
* as found inside the GNUstep windows package installations.
*/
static NSString*
idevroot(NSFileManager *manager, NSString *path)
{
NSString *pb;
NSString *tmp;
NSString *msys; NSString *msys;
BOOL isDir; BOOL isDir;
if (nil != (tmp = devroot(manager, path)))
{
return tmp;
}
msys = [path stringByAppendingPathComponent: @"msys"]; msys = [path stringByAppendingPathComponent: @"msys"];
if (YES == [manager fileExistsAtPath: msys isDirectory: &isDir] if (YES == [manager fileExistsAtPath: msys isDirectory: &isDir]
&& YES == isDir) && YES == isDir)
@ -2121,7 +2146,6 @@ devroot(NSFileManager *manager, NSString *path)
{ {
if (isdigit([file characterAtIndex: 0])) if (isdigit([file characterAtIndex: 0]))
{ {
NSString *pb;
float v = atof([file UTF8String]); float v = atof([file UTF8String]);
if (v <= maxVersion) if (v <= maxVersion)
@ -2141,10 +2165,6 @@ devroot(NSFileManager *manager, NSString *path)
return [best stringByStandardizingPath]; return [best stringByStandardizingPath];
} }
} }
tmp = path;
path = [tmp stringByDeletingLastPathComponent];
}
return nil; return nil;
} }
#endif #endif
@ -2360,7 +2380,8 @@ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\GNUstep",
{ {
ipath = [NSString stringWithCharacters: buf ipath = [NSString stringWithCharacters: buf
length: wcslen(buf)]; length: wcslen(buf)];
path = devroot(mgr, ipath);
path = idevroot(mgr, ipath);
} }
RegCloseKey(regKey); RegCloseKey(regKey);
} }