mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 08:40:44 +00:00
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:
parent
76a99f8dbb
commit
cc78018d45
1 changed files with 59 additions and 38 deletions
|
@ -2093,9 +2093,8 @@ NSOpenStepRootDirectory(void)
|
|||
|
||||
#if defined(__MINGW__)
|
||||
/* 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
|
||||
* bin/make from msys/version ... a simple heuristic to let us find the
|
||||
* native windows path to the msys root.
|
||||
* set up) is the point in the filesystem where we can reference bin/make ...
|
||||
* simple heuristic to let us find the native windows path to the msys root.
|
||||
*/
|
||||
static NSString*
|
||||
devroot(NSFileManager *manager, NSString *path)
|
||||
|
@ -2104,42 +2103,12 @@ devroot(NSFileManager *manager, NSString *path)
|
|||
|
||||
while (NO == [tmp isEqual: path])
|
||||
{
|
||||
NSString *msys;
|
||||
BOOL isDir;
|
||||
NSString *pb;
|
||||
|
||||
msys = [path stringByAppendingPathComponent: @"msys"];
|
||||
if (YES == [manager fileExistsAtPath: msys isDirectory: &isDir]
|
||||
&& YES == isDir)
|
||||
pb = [path stringByAppendingPathComponent: @"bin/make.exe"];
|
||||
if ([manager isExecutableFileAtPath: pb])
|
||||
{
|
||||
NSEnumerator *e;
|
||||
NSString *best = nil;
|
||||
NSString *file;
|
||||
float maxVersion = 0.0;
|
||||
|
||||
e = [[manager directoryContentsAtPath: msys] objectEnumerator];
|
||||
while (nil != (file = [e nextObject]))
|
||||
{
|
||||
if (isdigit([file characterAtIndex: 0]))
|
||||
{
|
||||
NSString *pb;
|
||||
float v = atof([file UTF8String]);
|
||||
|
||||
if (v <= maxVersion)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
file = [msys stringByAppendingPathComponent: file];
|
||||
pb = [file stringByAppendingPathComponent: @"bin/make.exe"];
|
||||
if ([manager isExecutableFileAtPath: pb])
|
||||
{
|
||||
best = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nil != best)
|
||||
{
|
||||
return [best stringByStandardizingPath];
|
||||
}
|
||||
return path;
|
||||
}
|
||||
tmp = path;
|
||||
path = [tmp stringByDeletingLastPathComponent];
|
||||
|
@ -2147,6 +2116,57 @@ devroot(NSFileManager *manager, NSString *path)
|
|||
|
||||
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;
|
||||
BOOL isDir;
|
||||
|
||||
if (nil != (tmp = devroot(manager, path)))
|
||||
{
|
||||
return tmp;
|
||||
}
|
||||
msys = [path stringByAppendingPathComponent: @"msys"];
|
||||
if (YES == [manager fileExistsAtPath: msys isDirectory: &isDir]
|
||||
&& YES == isDir)
|
||||
{
|
||||
NSEnumerator *e;
|
||||
NSString *best = nil;
|
||||
NSString *file;
|
||||
float maxVersion = 0.0;
|
||||
|
||||
e = [[manager directoryContentsAtPath: msys] objectEnumerator];
|
||||
while (nil != (file = [e nextObject]))
|
||||
{
|
||||
if (isdigit([file characterAtIndex: 0]))
|
||||
{
|
||||
float v = atof([file UTF8String]);
|
||||
|
||||
if (v <= maxVersion)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
file = [msys stringByAppendingPathComponent: file];
|
||||
pb = [file stringByAppendingPathComponent: @"bin/make.exe"];
|
||||
if ([manager isExecutableFileAtPath: pb])
|
||||
{
|
||||
best = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nil != best)
|
||||
{
|
||||
return [best stringByStandardizingPath];
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
#endif
|
||||
|
||||
NSArray *
|
||||
|
@ -2360,7 +2380,8 @@ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\GNUstep",
|
|||
{
|
||||
ipath = [NSString stringWithCharacters: buf
|
||||
length: wcslen(buf)];
|
||||
path = devroot(mgr, ipath);
|
||||
|
||||
path = idevroot(mgr, ipath);
|
||||
}
|
||||
RegCloseKey(regKey);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue