* Source/NSBundle.m: add NSBundle pathForAuxiliaryExecutable: and -privateFrameworksPath and their URL counterparts

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36973 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
lubosd 2013-08-14 21:10:35 +00:00
parent 91d53d6709
commit b0d091bb19
3 changed files with 82 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2013-08-14 Lubos Dolezel <lubos@dolezel.info>
* Source/NSBundle.m: add NSBundle pathForAuxiliaryExecutable: and
-privateFrameworksPath and their URL counterparts
2013-08-12 Richard Frith-Macdonald <rfm@gnu.org> 2013-08-12 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSThread.h: * Headers/Foundation/NSThread.h:

View file

@ -348,11 +348,22 @@ GS_EXPORT NSString* const NSLoadedClasses;
/** Returns the full path to the plug-in subdirectory of the bundle. */ /** Returns the full path to the plug-in subdirectory of the bundle. */
- (NSString *) builtInPlugInsPath; - (NSString *) builtInPlugInsPath;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2,GS_API_LATEST) #if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST)
/** Returns the full path to the plug-in subdirectory of the bundle. */ /** Returns the full path to the plug-in subdirectory of the bundle. */
- (NSURL *) builtInPlugInsURL; - (NSURL *) builtInPlugInsURL;
#endif #endif
/** Returns the full path to the private frameworks subdirectory of the bundle. */
- (NSString *) privateFrameworksPath;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST)
/** Returns the full path to the private frameworks subdirectory of the bundle. */
- (NSURL *) privateFrameworksURL;
#endif
/** Returns the bundle identifier, as defined by the CFBundleIdentifier /** Returns the bundle identifier, as defined by the CFBundleIdentifier
key in the infoDictionary */ key in the infoDictionary */
- (NSString *) bundleIdentifier; - (NSString *) bundleIdentifier;
@ -454,6 +465,13 @@ GS_EXPORT NSString* const NSLoadedClasses;
- (NSURL *) executableURL; - (NSURL *) executableURL;
#endif #endif
- (NSString *) pathForAuxiliaryExecutable: (NSString *) executableName;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6,GS_API_LATEST)
- (NSURL *)URLForAuxiliaryExecutable: (NSString *) executableName;
#endif
#endif #endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST) #if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST)

View file

@ -2742,6 +2742,35 @@ IF_NO_GC(
return [NSURL fileURLWithPath: [self executablePath]]; return [NSURL fileURLWithPath: [self executablePath]];
} }
- (NSString *) pathForAuxiliaryExecutable: (NSString *) executableName
{
NSString *version = _frameworkVersion;
if (!version)
version = @"Current";
if (_bundleType == NSBUNDLE_FRAMEWORK)
{
#if !defined(__MINGW__)
return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/%@",
version, executableName]];
#else
return [_path stringByAppendingPathComponent: executableName];
#endif
}
else
{
return [_path stringByAppendingPathComponent: executableName];
}
}
- (NSURL *) URLForAuxiliaryExecutable: (NSString *) executableName
{
return [NSURL fileURLWithPath: [self pathForAuxiliaryExecutable:
executableName]];
}
- (NSString *) resourcePath - (NSString *) resourcePath
{ {
NSString *version = _frameworkVersion; NSString *version = _frameworkVersion;
@ -2821,6 +2850,35 @@ IF_NO_GC(
return [NSURL fileURLWithPath: [self builtInPlugInsPath]]; return [NSURL fileURLWithPath: [self builtInPlugInsPath]];
} }
- (NSString *) privateFrameworksPath
{
NSString *version = _frameworkVersion;
if (!version)
version = @"Current";
if (_bundleType == NSBUNDLE_FRAMEWORK)
{
#if !defined(__MINGW__)
return [_path stringByAppendingPathComponent:
[NSString stringWithFormat:@"Versions/%@/PrivateFrameworks",
version]];
#else
return [_path stringByAppendingPathComponent: @"PrivateFrameworks"];
#endif
}
else
{
return [_path stringByAppendingPathComponent: @"PrivateFrameworks"];
}
}
- (NSURL *) privateFrameworksURL
{
return [NSURL fileURLWithPath: [self privateFrameworksPath]];
}
- (NSString*) bundleIdentifier - (NSString*) bundleIdentifier
{ {
return [[self infoDictionary] objectForKey: @"CFBundleIdentifier"]; return [[self infoDictionary] objectForKey: @"CFBundleIdentifier"];