mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
guess what caller meant when they give us bad path name
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26197 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cadb5df03b
commit
ddf52b8752
3 changed files with 85 additions and 9 deletions
|
@ -1231,8 +1231,39 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
{
|
||||
NSWarnMLog(@"NSBundle -initWithPath: requires absolute path names, "
|
||||
@"given '%@'", path);
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
if ([path length] > 0 &&
|
||||
([path characterAtIndex: 0]=='/' || [path characterAtIndex: 0]=='\\'))
|
||||
{
|
||||
NSString *root;
|
||||
unsigned length;
|
||||
|
||||
/* The path has a leading path separator, so we try assuming
|
||||
* that it's a path on the current filesystem, and append it
|
||||
* to the filesystem root.
|
||||
*/
|
||||
root = [[NSFileManager defaultManager] currentDirectoryPath];
|
||||
length = [root length];
|
||||
root = [root stringByDeletingLastPathComponent];
|
||||
while ([root length] != length)
|
||||
{
|
||||
length = [root length];
|
||||
root = [root stringByDeletingLastPathComponent];
|
||||
}
|
||||
path = [root stringByAppendingPathComponent: path];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Try appending to the current working directory.
|
||||
*/
|
||||
path = [[[NSFileManager defaultManager] currentDirectoryPath]
|
||||
stringByAppendingPathComponent: path];
|
||||
}
|
||||
#else
|
||||
path = [[[NSFileManager defaultManager] currentDirectoryPath]
|
||||
stringByAppendingPathComponent: path];
|
||||
stringByAppendingPathComponent: path];
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue