ProjectCenter now stores the project files under PROJECTNAME.pcproj to avoid

name clashes.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12017 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Philippe C.D. Robert 2002-01-07 09:37:19 +00:00
parent ba23332a84
commit fa7bda8926
16 changed files with 69 additions and 34 deletions

View file

@ -75,16 +75,19 @@ static PCAppProj *_creator = nil;
NSAssert(path,@"No valid project path provided!");
if ([fm createDirectoryAtPath:path attributes:nil]) {
if ([fm createDirectoryAtPath:path attributes:nil])
{
NSString *_file;
NSString *_resourcePath;
NSMutableDictionary *dict;
NSDictionary *infoDict;
NSString *plistFileName;
NSString *projectFile;
project = [[[PCAppProject alloc] init] autorelease];
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"PC" ofType:@"proj"];
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"PC"
ofType:@"proj"];
dict = [NSMutableDictionary dictionaryWithContentsOfFile:_file];
// Customise the project
@ -102,16 +105,20 @@ static PCAppProj *_creator = nil;
@"",@"Authors",
@"",@"URL",
@"Copyright (C) 200x by ...",@"Copyright",
@"Released under ...",@"CopyrightDescription", nil];
@"Released under...",@"CopyrightDescription",
nil];
plistFileName = [NSString stringWithFormat:@"%@Info.plist",
[path lastPathComponent]];
[infoDict writeToFile:[path stringByAppendingPathComponent:plistFileName] atomically:YES];
[dict setObject:[NSArray arrayWithObjects:plistFileName,nil]
forKey:PCOtherResources];
forKey:PCOtherResources];
// Save the project to disc
[dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"]
//projectFile = [NSString stringWithString:@"PC.project"];
projectFile = [NSString stringWithString:[path lastPathComponent]];
projectFile = [projectFile stringByAppendingPathExtension:@"pcproj"];
[dict writeToFile:[path stringByAppendingPathComponent:projectFile]
atomically:YES];
/*

View file

@ -64,4 +64,4 @@
GNUmakefile,
GNUmakefile.postamble
);
}
}

View file

@ -60,4 +60,4 @@
GNUmakefile,
GNUmakefile.postamble
);
}
}

View file

@ -80,6 +80,8 @@ static PCBundleProj *_creator = nil;
NSString *_file;
NSString *_resourcePath;
NSMutableDictionary *dict;
NSString *projectFile;
project = [[[PCBundleProject alloc] init] autorelease];
@ -92,7 +94,9 @@ static PCBundleProj *_creator = nil;
[dict setObject:[project principalClass] forKey:PCProjType];
// Save the project to disc
[dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"]
projectFile = [NSString stringWithString:[path lastPathComponent]];
projectFile = [projectFile stringByAppendingPathExtension:@"pcproj"];
[dict writeToFile:[path stringByAppendingPathComponent:projectFile]
atomically:YES];
/*

View file

@ -60,4 +60,4 @@
GNUmakefile,
GNUmakefile.postamble
);
}
}

View file

@ -81,6 +81,7 @@ static PCGormProj *_creator = nil;
NSMutableDictionary *dict;
NSDictionary *infoDict;
NSString *plistFileName;
NSString *projectFile;
project = [[[PCGormProject alloc] init] autorelease];
@ -114,7 +115,10 @@ static PCGormProj *_creator = nil;
forKey:PCMainGModelFile];
// Save the project to disc
[dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"] atomically:YES];
projectFile = [NSString stringWithString:[path lastPathComponent]];
projectFile = [projectFile stringByAppendingPathExtension:@"pcproj"];
[dict writeToFile:[path stringByAppendingPathComponent:projectFile]
atomically:YES];
/*
* Copy the project files to the provided path

View file

@ -64,4 +64,4 @@
GNUmakefile,
GNUmakefile.postamble
);
}
}

View file

@ -806,7 +806,8 @@
- (BOOL)save
{
BOOL ret = NO;
NSString *file = [projectPath stringByAppendingPathComponent:@"PC.project"];
//NSString *file = [projectPath stringByAppendingPathComponent:@"PC.project"];
NSString *file = [[projectPath stringByAppendingPathComponent:projectName] stringByAppendingPathExtension:@"pcproj"];
NSString *backup = [file stringByAppendingPathExtension:@"backup"];
NSFileManager *fm = [NSFileManager defaultManager];
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];

View file

@ -315,9 +315,6 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
if (!project)
{
#ifdef DEBUG
NSLog(@"Couldn't instantiate the project...");
#endif // DEBUG
return NO;
}

View file

@ -79,7 +79,8 @@ static PCLibProj *_creator = nil;
NSString *_file;
NSString *_resourcePath;
NSMutableDictionary *dict;
NSString *projectFile;
project = [[[PCLibProject alloc] init] autorelease];
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"PC" ofType:@"proj"];
@ -90,8 +91,11 @@ static PCLibProj *_creator = nil;
[dict setObject:[project principalClass] forKey:PCProjType];
// Save the project to disc
[dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"] atomically:YES];
projectFile = [NSString stringWithString:[path lastPathComponent]];
projectFile = [projectFile stringByAppendingPathExtension:@"pcproj"];
[dict writeToFile:[path stringByAppendingPathComponent:projectFile]
atomically:YES];
// Copy the project files to the provided path
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"GNUmakefile" ofType:@"postamble"];
[fm copyPath:_file toPath:[path stringByAppendingPathComponent:@"GNUmakefile.postamble"] handler:nil];

View file

@ -61,4 +61,4 @@
GNUmakefile,
GNUmakefile.postamble
);
}
}

View file

@ -79,7 +79,8 @@ static PCToolProj *_creator = nil;
NSString *_file;
NSString *_resourcePath;
NSMutableDictionary *dict;
NSString *projectFile;
project = [[[PCToolProject alloc] init] autorelease];
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"PC" ofType:@"proj"];
@ -90,7 +91,10 @@ static PCToolProj *_creator = nil;
[dict setObject:[project principalClass] forKey:PCProjType];
// Save the project to disc
[dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"] atomically:YES];
projectFile = [NSString stringWithString:[path lastPathComponent]];
projectFile = [projectFile stringByAppendingPathExtension:@"pcproj"];
[dict writeToFile:[path stringByAppendingPathComponent:projectFile]
atomically:YES];
// Copy the project files to the provided path
_file = [[NSBundle bundleForClass:[self class]] pathForResource:@"GNUmakefile" ofType:@"postamble"];

View file

@ -62,4 +62,4 @@
GNUmakefile,
GNUmakefile.postamble
);
}
}

View file

@ -95,7 +95,7 @@
- (void)openProject:(id)sender
{
NSString *projectPath;
NSString *projPath;
NSOpenPanel *openPanel;
int retval;
@ -104,17 +104,23 @@
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:[NSArray arrayWithObjects:@"project",nil]];
retval = [openPanel runModalForDirectory:[[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpenDirectory"] file:nil types:[NSArray arrayWithObjects:@"project",@"pcproj",nil]];
if (retval == NSOKButton) {
BOOL isDir;
[[NSUserDefaults standardUserDefaults] setObject:[openPanel directory] forKey:@"LastOpenDirectory"];
projectPath = [[openPanel filenames] objectAtIndex:0];
[[NSUserDefaults standardUserDefaults] setObject:[openPanel directory]
forKey:@"LastOpenDirectory"];
projPath = [[openPanel filenames] objectAtIndex:0];
if ([[NSFileManager defaultManager] fileExistsAtPath:projectPath isDirectory:&isDir] && !isDir) {
if (![projectManager openProjectAt:projectPath]) {
NSRunAlertPanel(@"Attention!",@"Couldn't open %@!",@"OK",nil,nil,[projectPath stringByDeletingLastPathComponent]);
if ([[NSFileManager defaultManager] fileExistsAtPath:projPath
isDirectory:&isDir] && !isDir){
if (![projectManager openProjectAt:projPath])
{
NSRunAlertPanel(@"Attention!",
@"Couldn't open %@!",
@"OK",nil,nil,
[projPath stringByDeletingLastPathComponent]);
}
}
}
@ -131,12 +137,16 @@
[sp setAccessoryView:projectTypeAccessaryView];
runResult = [sp runModalForDirectory:NSHomeDirectory() file:@""];
if (runResult == NSOKButton) {
if (runResult == NSOKButton)
{
NSString *projectType = [projectTypePopup titleOfSelectedItem];
NSString *className = [[appController projectTypes] objectForKey:projectType];
if (![projectManager createProjectOfType:className path:[sp filename]]) {
NSRunAlertPanel(@"Attention!",@"Failed to create %@!",@"OK",nil,nil,[sp filename]);
if (![projectManager createProjectOfType:className path:[sp filename]])
{
NSRunAlertPanel(@"Attention!",
@"Failed to create %@!",
@"OK",nil,nil,[sp filename]);
}
}
}
@ -150,7 +160,7 @@
{
NSString *proj;
// Show save panel
// Show save panel
[projectManager saveProjectAs:proj];
}

View file

@ -95,4 +95,4 @@
GNUmakefile,
GNUmakefile.postamble
);
}
}

View file

@ -6,6 +6,10 @@
NSUnixExtensions = ( "project" );
NSIcon = "ProjectCenter.tiff";
},
{
NSUnixExtensions = ( "pcproj" );
NSIcon = "ProjectCenter.tiff";
},
{
NSUnixExtensions = ( "m" );
NSIcon = "FileIcon_.m.tiff";