mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-17 08:01:24 +00:00
* Framework/PCProject.m: Implement openWrapperAtPath:
* Framework/PCProjectManager.m: Change method call to use openWrapperAtPath: * Headers/ProjectCenter/PCProject.h: Add wrapperPath ivar. * Modules/Projects/Application/PCAppProject.m: Change method to call super. * Modules/Projects/Tool/PCToolProject.m: Change method to call super. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@28138 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
03a7c073c2
commit
f2a055ef97
6 changed files with 86 additions and 24 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2009-03-27 03:00-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Framework/PCProject.m: Implement openWrapperAtPath:
|
||||
* Framework/PCProjectManager.m: Change method call to use
|
||||
openWrapperAtPath:
|
||||
* Headers/ProjectCenter/PCProject.h: Add wrapperPath ivar.
|
||||
* Modules/Projects/Application/PCAppProject.m:
|
||||
Change method to call super.
|
||||
* Modules/Projects/Tool/PCToolProject.m: Change method to
|
||||
call super.
|
||||
|
||||
2009-03-27 01:18-EDT Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Framework/English.lproj/Builder.gorm: Update icons for stop and
|
||||
|
|
|
@ -84,11 +84,55 @@ NSString
|
|||
return self;
|
||||
}
|
||||
|
||||
- (PCProject *)openWithDictionaryAt:(NSString *)path
|
||||
- (PCProject *)openWithWrapperAt:(NSString *)path
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
NSString *aPath = path;
|
||||
|
||||
[self assignProjectDict:dict atPath:path];
|
||||
if([[aPath lastPathComponent] isEqual: @"PC.project"])
|
||||
{
|
||||
NSString *newPath = [aPath stringByDeletingLastPathComponent];
|
||||
if([[[newPath lastPathComponent] pathExtension]
|
||||
isEqual: @"pcproj"] == NO)
|
||||
{
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile: aPath];
|
||||
|
||||
projectFileWrapper = [[NSFileWrapper alloc]
|
||||
initDirectoryWithFileWrappers:
|
||||
[NSMutableDictionary dictionaryWithCapacity: 3]];
|
||||
[projectFileWrapper addRegularFileWithContents:
|
||||
[NSData dataWithBytes: [[dict description] cString]
|
||||
length: [[dict description] length]]
|
||||
preferredFilename: @"PC.project"];
|
||||
[self assignProjectDict: dict
|
||||
atPath: path];
|
||||
|
||||
return self;
|
||||
}
|
||||
else
|
||||
{
|
||||
aPath = newPath;
|
||||
}
|
||||
}
|
||||
|
||||
projectFileWrapper = [[NSFileWrapper alloc] initWithPath: aPath];
|
||||
if(projectFileWrapper != nil)
|
||||
{
|
||||
NSDictionary *wrappers = [projectFileWrapper fileWrappers];
|
||||
NSData *data = [[wrappers objectForKey: @"PC.project"] regularFileContents];
|
||||
NSData *userData = [[wrappers objectForKey: [NSUserName() stringByAppendingPathExtension: @"project"]]
|
||||
regularFileContents];
|
||||
NSMutableDictionary *dict = [[[[NSString alloc] initWithData: data
|
||||
encoding: NSASCIIStringEncoding]
|
||||
propertyList] mutableCopy];
|
||||
NSDictionary *udict = [[[NSString alloc] initWithData: userData
|
||||
encoding: NSASCIIStringEncoding]
|
||||
propertyList];
|
||||
|
||||
[dict addEntriesFromDictionary: udict];
|
||||
[self assignProjectDict:dict atPath: aPath];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -151,7 +195,8 @@ NSString
|
|||
projectDict = [[NSMutableDictionary alloc] initWithDictionary:pDict];
|
||||
|
||||
// Project path
|
||||
if ([[pPath lastPathComponent] isEqualToString:@"PC.project"])
|
||||
if ([[pPath lastPathComponent] isEqualToString:@"PC.project"] ||
|
||||
[[[pPath lastPathComponent] pathExtension] isEqualToString:@"pcproj"])
|
||||
{
|
||||
[self setProjectPath:[pPath stringByDeletingLastPathComponent]];
|
||||
}
|
||||
|
@ -337,7 +382,7 @@ NSString
|
|||
NSString *projectFile = nil;
|
||||
NSMutableDictionary *projectFileDict = nil;
|
||||
|
||||
projectFile = [projectPath stringByAppendingPathComponent:[NSUserName() stringByAppendingPathExtension:@"project"]];
|
||||
projectFile = [NSUserName() stringByAppendingPathExtension:@"project"];
|
||||
projectFileDict = [[NSMutableDictionary alloc] initWithCapacity:4];
|
||||
|
||||
// Project Window
|
||||
|
@ -407,8 +452,16 @@ NSString
|
|||
// Now save it directly to username.project file
|
||||
[projectFileDict setObject:windows forKey:@"PC_WINDOWS"];
|
||||
|
||||
[projectFileDict writeToFile:projectFile atomically:YES];
|
||||
// add the file and write the wrapper.
|
||||
[projectFileWrapper addRegularFileWithContents:
|
||||
[NSData dataWithBytes: [[projectFileDict description] cString]
|
||||
length: [[projectFileDict description] length]]
|
||||
preferredFilename: projectFile];
|
||||
[projectFileWrapper writeToFile: wrapperPath
|
||||
atomically: YES
|
||||
updateFilenames: YES];
|
||||
|
||||
// release
|
||||
[projectFileDict release];
|
||||
|
||||
return YES;
|
||||
|
@ -420,13 +473,17 @@ NSString
|
|||
int spCount = [loadedSubprojects count];
|
||||
int i;
|
||||
NSString *wrapperFile = [projectName stringByAppendingPathExtension: @"pcproj"];
|
||||
NSString *wrapperPath = [projectPath stringByAppendingPathComponent: wrapperFile];
|
||||
NSString *file = @"PC.project";
|
||||
NSString *backup = [wrapperPath stringByAppendingPathExtension:@"backup"];
|
||||
|
||||
NSMutableDictionary *dict = [projectDict mutableCopy];
|
||||
|
||||
// remove key..
|
||||
[dict removeObjectForKey: @"PC_WINDOWS"];
|
||||
|
||||
// initialize the wrapper...
|
||||
projectFileWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:
|
||||
[NSMutableDictionary dictionaryWithCapacity: 3]];
|
||||
wrapperPath = [projectPath stringByAppendingPathComponent: wrapperFile];
|
||||
|
||||
// load subprojects...
|
||||
for (i = 0; i < spCount; i++)
|
||||
|
@ -461,8 +518,8 @@ NSString
|
|||
[projectDict setObject: [[NSCalendarDate date] description]
|
||||
forKey: PCLastEditing];
|
||||
[projectFileWrapper addRegularFileWithContents:
|
||||
[NSData dataWithBytes: [[projectDict description] cString]
|
||||
length: [[projectDict description] length]]
|
||||
[NSData dataWithBytes: [[dict description] cString]
|
||||
length: [[dict description] length]]
|
||||
preferredFilename: file];
|
||||
if ([projectFileWrapper
|
||||
writeToFile:wrapperPath
|
||||
|
|
|
@ -572,7 +572,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
protocol:@protocol(ProjectType)];
|
||||
}
|
||||
|
||||
if (!project || ![project openWithDictionaryAt:aPath])
|
||||
if (!project || ![project openWithWrapperAt:aPath])
|
||||
{
|
||||
NSRunAlertPanel(@"Open Project",
|
||||
@"Unable to open project '%@'.\nReport bug, please!",
|
||||
|
@ -648,7 +648,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
|||
{
|
||||
NSArray *files = nil;
|
||||
NSString *filePath = nil;
|
||||
NSArray *fileTypes = [NSArray arrayWithObjects:@"project",@"pcproj",nil];
|
||||
NSArray *fileTypes = [NSArray arrayWithObjects:@"pcproj",@"project",nil];
|
||||
|
||||
files = [fileManager filesOfTypes:fileTypes
|
||||
operation:PCOpenProjectOperation
|
||||
|
|
|
@ -74,6 +74,7 @@ extern NSString *PCProjectBreakpointNotification;
|
|||
PCProject *rootProject;
|
||||
PCProject *superProject;
|
||||
NSFileWrapper *projectFileWrapper;
|
||||
NSString *wrapperPath;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@ -81,8 +82,7 @@ extern NSString *PCProjectBreakpointNotification;
|
|||
// ============================================================================
|
||||
|
||||
- (id)init;
|
||||
//- (id)initWithProjectDictionary:(NSDictionary *)dict path:(NSString *)path;
|
||||
- (PCProject *)openWithDictionaryAt:(NSString *)path;
|
||||
- (PCProject *)openWithWrapperAt:(NSString *)path;
|
||||
- (void)dealloc;
|
||||
- (void)loadPreferences:(NSNotification *)aNotification;
|
||||
|
||||
|
|
|
@ -256,13 +256,10 @@
|
|||
// --- PCProject overridings
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
- (PCProject *)openWithDictionaryAt:(NSString *)path
|
||||
- (PCProject *)openWithWrapperAt:(NSString *)path
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
|
||||
[self assignProjectDict:dict atPath:path];
|
||||
[super openWithWrapperAt: path];
|
||||
[self loadInfoFile];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -205,13 +205,10 @@
|
|||
// --- PCProject overridings
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
- (PCProject *)openWithDictionaryAt:(NSString *)path
|
||||
- (PCProject *)openWithWrapperAt:(NSString *)path
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
|
||||
[self assignProjectDict:dict atPath:path];
|
||||
[super openWithWrapperAt: path];
|
||||
[self loadInfoFile];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue