add pcproj_bundle.make

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@16637 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Sergii Stoian 2003-05-05 14:40:11 +00:00
parent f837d12425
commit e70e0e7004
12 changed files with 90 additions and 67 deletions

View file

@ -1,3 +1,24 @@
2003-05-05 Serg Stoyan <stoyan@hologr.com>
* GNUmakefile: Place ProjectCenter subproject after PCLib.
* pcproj_bundle.make: Added.
* PCAppProj/GNUmakefile: Added include pcproj_bundle.make.
* PCBaseFileTypes/GNUmakefile: Ditto.
* PCBundleProj/GNUmakefile: Ditto.
* PCGormProj/GNUmakefile: Ditto.
* PCLibProj/GNUmakefile: Ditto.
* PCRenaissanceProj/GNUmakefile: Ditto.
* PCToolProj/GNUmakefile: Ditto.
* PCLib/PCBundleLoader.h:
(loadBundlesAtPath:): Added.
* PCLib/PCBundleLoader.m:
(loadBundles): First load bundles from main bundle's resource
directory, then load third party bundles from directory
Library/ApplicationSupport/ProjectCenter.
(loadBundlesAtPath:): Added. Loads bundles from specified directory.
2003-05-02 Serg Stoyan <stoyan@on.com.ua>
* PCLib/PCProjectBuilder.h:

View file

@ -35,14 +35,14 @@ PACKAGE_NAME = ProjectCenter
SUBPROJECTS = \
PCLib \
ProjectCenter \
PCAppProj \
PCGormProj \
PCBundleProj \
PCToolProj \
PCLibProj \
PCBaseFileTypes \
PCRenaissanceProj \
ProjectCenter
PCRenaissanceProj
-include GNUMakefile.preamble

View file

@ -9,7 +9,7 @@
#
include $(GNUSTEP_MAKEFILES)/common.make
include ../pcproj_bundle.make
#
# Subprojects
@ -23,8 +23,6 @@ include $(GNUSTEP_MAKEFILES)/common.make
PACKAGE_NAME = PCAppProj
BUNDLE_NAME = PCAppProj
BUNDLE_EXTENSION = .bundle
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Library/ProjectCenter
PCAppProj_PRINCIPAL_CLASS = PCAppProj

View file

@ -9,7 +9,7 @@
#
include $(GNUSTEP_MAKEFILES)/common.make
include ../pcproj_bundle.make
#
# Subprojects
@ -23,8 +23,6 @@ include $(GNUSTEP_MAKEFILES)/common.make
PACKAGE_NAME = PCBaseFileTypes
BUNDLE_NAME = PCBaseFileTypes
BUNDLE_EXTENSION = .bundle
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Library/ProjectCenter
PCBaseFileTypes_PRINCIPAL_CLASS = PCBaseFileType

View file

@ -9,6 +9,7 @@
#
include $(GNUSTEP_MAKEFILES)/common.make
include ../pcproj_bundle.make
#
@ -23,8 +24,6 @@ include $(GNUSTEP_MAKEFILES)/common.make
PACKAGE_NAME = PCBundleProj
BUNDLE_NAME = PCBundleProj
BUNDLE_EXTENSION = .bundle
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Library/ProjectCenter
PCBundleProj_PRINCIPAL_CLASS = PCBundleProj

View file

@ -9,7 +9,7 @@
#
include $(GNUSTEP_MAKEFILES)/common.make
include ../pcproj_bundle.make
#
# Subprojects
@ -23,8 +23,6 @@ include $(GNUSTEP_MAKEFILES)/common.make
PACKAGE_NAME = PCGormProj
BUNDLE_NAME = PCGormProj
BUNDLE_EXTENSION = .bundle
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Library/ProjectCenter
PCGormProj_PRINCIPAL_CLASS = PCGormProj

View file

@ -54,11 +54,12 @@
- (id)delegate;
- (void)setDelegate:(id)aDelegate;
- (void)loadBundles;
// Load all bundles found in the BundlePaths
- (void)loadBundles;
- (void)loadBundlesAtPath: (NSString *)path;
// Returns all loaded ProjectCenter bundles.
- (NSArray *)loadedBundles;
// Returns all loaded ProjectCenter bundles.
@end

View file

@ -40,30 +40,30 @@
- (void)loadAdditionalBundlesAt:(NSString *)path
{
NSBundle *bundle;
NSAssert(path,@"No valid bundle path specified!");
NSBundle *bundle;
NSAssert(path,@"No valid bundle path specified!");
#ifdef DEBUG
NSLog([NSString stringWithFormat:@"Loading bundle %@...",path]);
NSLog([NSString stringWithFormat:@"Loading bundle %@...",path]);
#endif// DEBUG
if ((bundle = [NSBundle bundleWithPath:path]))
if ((bundle = [NSBundle bundleWithPath:path]))
{
[loadedBundles addObject:bundle];
[loadedBundles addObject:bundle];
#ifdef DEBUG
NSLog([NSString stringWithFormat:@"Bundle %@ successfully loaded!",path]);
NSLog([NSString stringWithFormat:@"Bundle %@ successfully loaded!",path]);
#endif// DEBUG
if (delegate && [delegate respondsToSelector:@selector(bundleLoader: didLoadBundle:)])
if (delegate && [delegate respondsToSelector:@selector(bundleLoader: didLoadBundle:)])
{
[delegate bundleLoader:self didLoadBundle:bundle];
}
[delegate bundleLoader:self didLoadBundle:bundle];
}
}
else
else
{
NSRunAlertPanel(@"Attention!",@"Could not load %@!",@"OK",nil,nil,path);
NSRunAlertPanel(@"Attention!",@"Could not load %@!",@"OK",nil,nil,path);
}
}
@ -100,58 +100,67 @@
delegate = aDelegate;
}
- (void)loadBundles
- (void) loadBundles
{
NSEnumerator *enumerator;
NSString *bundleName;
NSArray *dir;
NSString *path = [[NSUserDefaults standardUserDefaults] objectForKey:BundlePaths];
NSString *path = nil;
if (!path || [path isEqualToString:@""])
// Load bundles that comes with ProjectCenter
path = [[NSBundle mainBundle] resourcePath];
if (![[NSFileManager defaultManager] fileExistsAtPath: path])
{
[NSException raise: @"PCBundleLoaderPathException"
format: @"No valid bundles at path:\n%@", path];
return;
}
[self loadBundlesAtPath: path];
// Load third party bundles
path = [[NSUserDefaults standardUserDefaults] objectForKey:BundlePaths];
if (!path || [path isEqualToString: @""])
{
NSDictionary *env = [[NSProcessInfo processInfo] environment];
NSString *prefix = [env objectForKey:@"GNUSTEP_INSTALLATION_DIR"];
if (prefix && ![prefix isEqualToString:@""])
{
path =[prefix stringByAppendingPathComponent:@"Library/ProjectCenter"];
}
else
{
path = [NSString stringWithString:@"/usr/GNUstep/Local/Library/ProjectCenter"];
}
[[NSUserDefaults standardUserDefaults] setObject:path forKey:BundlePaths];
NSString *prefix = [env objectForKey: @"GNUSTEP_SYSTEM_ROOT"];
path = [prefix stringByAppendingPathComponent:
@"Library/ApplicationSupport/ProjectCenter"];
[[NSUserDefaults standardUserDefaults] setObject: path
forKey: BundlePaths];
[[NSUserDefaults standardUserDefaults] synchronize];
}
if (![[NSFileManager defaultManager] fileExistsAtPath:path])
#ifdef DEBUG
if (![[NSFileManager defaultManager] fileExistsAtPath: path])
{
[NSException raise:@"PCBundleLoaderPathException"
format:@"No valid bundle path specified:\n%@",path];
NSLog([NSString stringWithFormat: @"No third party bundles at %@", path]);
return;
}
#ifdef DEBUG
else
else
{
NSLog([NSString stringWithFormat:@"Loading bundles at %@",path]);
NSLog([NSString stringWithFormat: @"Loading bundles at %@", path]);
}
#endif// DEBUG
[self loadBundlesAtPath: path];
}
NSLog([NSString stringWithFormat:@"Loading bundles at %@",path]);
- (void) loadBundlesAtPath: (NSString *)path
{
NSEnumerator *enumerator;
NSString *bundleName;
NSArray *dir;
dir = [[NSFileManager defaultManager] directoryContentsAtPath:path];
enumerator = [dir objectEnumerator];
dir = [[NSFileManager defaultManager] directoryContentsAtPath: path];
enumerator = [dir objectEnumerator];
while (bundleName = [enumerator nextObject])
while (bundleName = [enumerator nextObject])
{
if ([[bundleName pathExtension] isEqualToString:@"bundle"])
if ([[bundleName pathExtension] isEqualToString:@"bundle"])
{
NSString *fullPath;
fullPath = [NSString stringWithFormat:@"%@/%@",path,bundleName];
[self loadAdditionalBundlesAt:fullPath];
}
NSString *fullPath;
fullPath = [NSString stringWithFormat:@"%@/%@",path,bundleName];
[self loadAdditionalBundlesAt:fullPath];
}
}
}

View file

@ -9,6 +9,7 @@
#
include $(GNUSTEP_MAKEFILES)/common.make
include ../pcproj_bundle.make
#
@ -23,8 +24,6 @@ include $(GNUSTEP_MAKEFILES)/common.make
PACKAGE_NAME = PCLibProj
BUNDLE_NAME = PCLibProj
BUNDLE_EXTENSION = .bundle
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Library/ProjectCenter
PCLibProj_PRINCIPAL_CLASS = PCLibProj

View file

@ -9,6 +9,7 @@
#
include $(GNUSTEP_MAKEFILES)/common.make
include ../pcproj_bundle.make
#
@ -23,8 +24,6 @@ include $(GNUSTEP_MAKEFILES)/common.make
PACKAGE_NAME = PCRenaissanceProj
BUNDLE_NAME = PCRenaissanceProj
BUNDLE_EXTENSION = .bundle
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Library/ProjectCenter
PCRenaissanceProj_PRINCIPAL_CLASS = PCRenaissanceProj

View file

@ -9,6 +9,7 @@
#
include $(GNUSTEP_MAKEFILES)/common.make
include ../pcproj_bundle.make
#
@ -23,8 +24,6 @@ include $(GNUSTEP_MAKEFILES)/common.make
PACKAGE_NAME = PCToolProj
BUNDLE_NAME = PCToolProj
BUNDLE_EXTENSION = .bundle
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Library/ProjectCenter
PCToolProj_PRINCIPAL_CLASS = PCToolProj

2
pcproj_bundle.make Normal file
View file

@ -0,0 +1,2 @@
BUNDLE_EXTENSION = .bundle
BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Applications/ProjectCenter.app/Resources