mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-14 06:31:31 +00:00
Updated bundle lookup for new filesystem layout; fixed infinite loop when building
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@24785 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d93c8551e6
commit
73e911a0e5
6 changed files with 47 additions and 42 deletions
|
@ -1,3 +1,19 @@
|
|||
2007-03-06 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* GNUmakefile: Set GNUSTEP_MAKEFILES using gnustep-config if not yet set.
|
||||
Do not set GNUSTEP_INSTALLATION_DOMAIN.
|
||||
* PCBundleManager.m ([-loadBundlesWithExtension:]): Rewritten to
|
||||
use the proper NSSearchPathForDirectoriesInDomains API so that it
|
||||
works with all filesystem layouts. Also, load bundles from all
|
||||
ApplicationSupport/ProjectCenter locations, not just the System
|
||||
one.
|
||||
* Framework/PCPrefController.m (-setBundlePath:): Method removed.
|
||||
* Headers/ProjectCenter/PCPrefController.h: Same change.
|
||||
|
||||
* PCFileManager.m ([-createDirectoriesIfNeededAtPath:]): Avoid
|
||||
infinite loop that would be triggered the first time you tried to
|
||||
build your project.
|
||||
|
||||
2007-02-14 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* GNUmakefile.bundles (BUNDLE_INSTALL_DIR): Fixed definition basing
|
||||
|
|
|
@ -200,7 +200,10 @@
|
|||
// ---
|
||||
- (void)loadBundlesWithExtension:(NSString *)extension
|
||||
{
|
||||
NSString *path = [self resourcePath];
|
||||
NSEnumerator *enumerator;
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
BOOL isDir;
|
||||
NSString *path = [self resourcePath];
|
||||
|
||||
if (path)
|
||||
{
|
||||
|
@ -208,29 +211,19 @@
|
|||
}
|
||||
|
||||
// Load third party bundles
|
||||
path = [[NSUserDefaults standardUserDefaults] objectForKey:BundlePaths];
|
||||
if (!path || [path isEqualToString: @""])
|
||||
enumerator = [NSSearchPathForDirectoriesInDomains
|
||||
(NSApplicationSupportDirectory, NSAllDomainsMask, YES)
|
||||
objectEnumerator];
|
||||
while ((path = [enumerator nextObject]) != nil)
|
||||
{
|
||||
NSDictionary *env = [[NSProcessInfo processInfo] environment];
|
||||
NSString *prefix = [env objectForKey: @"GNUSTEP_SYSTEM_ROOT"];
|
||||
path = [path stringByAppendingPathComponent: @"ProjectCenter"];
|
||||
|
||||
path = [prefix stringByAppendingPathComponent:
|
||||
@"Library/ApplicationSupport/ProjectCenter"];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:path
|
||||
forKey:BundlePaths];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:path])
|
||||
{
|
||||
PCLogInfo(self, @"No third party bundles at %@", path);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
PCLogInfo(self, @"Loading bundles at %@", path);
|
||||
[self loadBundlesAtPath:path withExtension:extension];
|
||||
if ([fileManager fileExistsAtPath: path isDirectory: &isDir]
|
||||
&& isDir)
|
||||
{
|
||||
PCLogInfo(self, @"Loading bundles at %@", path);
|
||||
[self loadBundlesAtPath:path withExtension:extension];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,14 +161,22 @@ static PCFileManager *_mgr = nil;
|
|||
- (BOOL)createDirectoriesIfNeededAtPath:(NSString *)path
|
||||
{
|
||||
NSString *_path = [NSString stringWithString:path];
|
||||
NSString *_oldPath = nil;
|
||||
NSMutableArray *pathArray = [NSMutableArray array];
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
BOOL isDir;
|
||||
int i;
|
||||
|
||||
while (![fm fileExistsAtPath:_path isDirectory:&isDir])
|
||||
/* We stop when we find a file, or when we can't remove any path
|
||||
* component any more. Else, you may end up in an infinite loop if
|
||||
* _path = @"".
|
||||
*/
|
||||
while (_path != nil
|
||||
&& ![_path isEqualToString: _oldPath]
|
||||
&& ![fm fileExistsAtPath:_path isDirectory:&isDir])
|
||||
{
|
||||
[pathArray addObject:[_path lastPathComponent]];
|
||||
_oldPath = _path;
|
||||
_path = [_path stringByDeletingLastPathComponent];
|
||||
}
|
||||
|
||||
|
|
|
@ -242,10 +242,6 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
[displayLog setState:
|
||||
([[preferencesDict objectForKey:DisplayLog]
|
||||
isEqualToString:@"YES"]) ? NSOnState : NSOffState];
|
||||
|
||||
// Bundles
|
||||
/* [bundlePathField setStringValue:
|
||||
(val = [preferencesDict objectForKey: BundlePaths]) ? val : @""];*/
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
|
@ -891,17 +887,5 @@ static PCPrefController *_prefCtrllr = nil;
|
|||
forKey:DisplayLog];
|
||||
}
|
||||
|
||||
// Bundles
|
||||
- (void)setBundlePath:(id)sender
|
||||
{
|
||||
NSString *path = [bundlePathField stringValue];
|
||||
|
||||
if (path)
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setObject:path forKey:BundlePaths];
|
||||
[preferencesDict setObject:path forKey:BundlePaths];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
#
|
||||
# GNUmakefile
|
||||
#
|
||||
ifeq ($(GNUSTEP_MAKEFILES),)
|
||||
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
|
||||
endif
|
||||
|
||||
ifeq ($(GNUSTEP_MAKEFILES),)
|
||||
$(error You need to set GNUSTEP_MAKEFILES before compiling!)
|
||||
endif
|
||||
|
||||
GNUSTEP_INSTALLATION_DOMAIN = SYSTEM
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
#
|
||||
|
|
|
@ -120,8 +120,6 @@
|
|||
- (void)setRememberWindows:(id)sender;
|
||||
- (void)setDisplayLog:(id)sender;
|
||||
|
||||
- (void)setBundlePath:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue