Cleaned up the writeMakefile method

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@11910 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Philippe C.D. Robert 2001-12-29 14:07:58 +00:00
parent c574c7cae4
commit 36d234f2e7
5 changed files with 47 additions and 76 deletions

View file

@ -103,14 +103,16 @@ static PCAppProj *_creator = nil;
@"",@"URL",
@"Copyright (C) 200x by ...",@"Copyright",
@"Released under ...",@"CopyrightDescription", nil];
plistFileName = [NSString stringWithFormat:@"%@Info.plist",[path lastPathComponent]];
plistFileName = [NSString stringWithFormat:@"%@Info.plist",
[path lastPathComponent]];
[infoDict writeToFile:[path stringByAppendingPathComponent:plistFileName] atomically:YES];
[dict setObject:[NSArray arrayWithObjects:plistFileName,nil]
forKey:PCOtherResources];
// Save the project to disc
[dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"] atomically:YES];
[dict writeToFile:[path stringByAppendingPathComponent:@"PC.project"]
atomically:YES];
/*
* Copy the project files to the provided path

View file

@ -161,27 +161,19 @@
- (BOOL)writeMakefile
{
NSFileManager *fm = [NSFileManager defaultManager];
NSString *makefile = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
NSData *content;
NSData *mfd;
NSString *mf = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if (![super writeMakefile]) {
NSLog(@"Couldn't update PC.project...");
}
// Save the project file
[super writeMakefile];
if (![fm movePath:makefile toPath:[projectPath stringByAppendingPathComponent:@"GNUmakefile~"] handler:nil]) {
NSLog(@"Couldn't write a backup GNUmakefile...");
if (mfd = [[PCAppMakefileFactory sharedFactory] makefileForProject:self]) {
if ([mfd writeToFile:mf atomically:YES]) {
return YES;
}
}
if (!(content = [[PCAppMakefileFactory sharedFactory] makefileForProject:self])) {
NSLog([NSString stringWithFormat:@"Couldn't build the GNUmakefile %@!",makefile]);
return NO;
}
if (![content writeToFile:makefile atomically:YES]) {
NSLog([NSString stringWithFormat:@"Couldn't write the GNUmakefile %@!",makefile]);
return NO;
}
return YES;
return NO;
}
- (BOOL)isValidDictionary:(NSDictionary *)aDict

View file

@ -111,28 +111,20 @@
- (BOOL)writeMakefile
{
NSFileManager *fm = [NSFileManager defaultManager];
NSString *makefile = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
NSData *content;
if (![super writeMakefile]) {
NSLog(@"Couldn't update PC.project...");
}
if (![fm movePath:makefile toPath:[projectPath stringByAppendingPathComponent:@"GNUmakefile~"] handler:nil]) {
NSLog(@"Couldn't write a backup GNUmakefile...");
}
if (!(content = [[PCBundleMakefileFactory sharedFactory] makefileForProject:self])) {
NSLog([NSString stringWithFormat:@"Couldn't build the GNUmakefile %@!",makefile]);
return NO;
}
NSFileManager *fm = [NSFileManager defaultManager];
NSData *mfd;
NSString *mf = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if (![content writeToFile:makefile atomically:YES]) {
NSLog([NSString stringWithFormat:@"Couldn't write the GNUmakefile %@!",makefile]);
// Save the project file
[super writeMakefile];
if(mfd = [[PCBundleMakefileFactory sharedFactory] makefileForProject:self]){
if ([mfd writeToFile:mf atomically:YES]) {
return YES;
}
}
return NO;
}
return YES;
}
- (BOOL)isValidDictionary:(NSDictionary *)aDict

View file

@ -159,27 +159,19 @@
- (BOOL)writeMakefile
{
NSFileManager *fm = [NSFileManager defaultManager];
NSString *makefile = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
NSData *content;
NSData *mfd;
NSString *mf = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if (![super writeMakefile]) {
NSLog(@"Couldn't update PC.project...");
}
// Save the project file
[super writeMakefile];
if (mfd = [[PCGormMakefileFactory sharedFactory] makefileForProject:self]) {
if ([mfd writeToFile:mf atomically:YES]) {
return YES;
}
}
if (![fm movePath:makefile toPath:[projectPath stringByAppendingPathComponent:@"GNUmakefile~"] handler:nil]) {
NSLog(@"Couldn't write a backup GNUmakefile...");
}
if (!(content = [[PCGormMakefileFactory sharedFactory] makefileForProject:self])) {
NSLog([NSString stringWithFormat:@"Couldn't build the GNUmakefile %@!",makefile]);
return NO;
}
if (![content writeToFile:makefile atomically:YES]) {
NSLog([NSString stringWithFormat:@"Couldn't write the GNUmakefile %@!",makefile]);
return NO;
}
return YES;
return NO;
}
- (BOOL)isValidDictionary:(NSDictionary *)aDict

View file

@ -88,26 +88,19 @@
- (BOOL)writeMakefile
{
NSFileManager *fm = [NSFileManager defaultManager];
NSString *makefile = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
NSData *content;
NSData *mfd;
NSString *mf = [projectPath stringByAppendingPathComponent:@"GNUmakefile"];
if (![super writeMakefile]) {
NSLog(@"<%@ %x>: Couldn't update PC.project...",[self class],self);
}
// Save the project file
[super writeMakefile];
if (mfd = [[PCToolMakefileFactory sharedFactory] makefileForProject:self]) {
if ([mfd writeToFile:mf atomically:YES]) {
return YES;
}
}
if (![fm movePath:makefile toPath:[projectPath stringByAppendingPathComponent:@"GNUmakefile~"] handler:nil]) {
NSLog(@"Couldn't write a backup GNUmakefile...");
}
if (!(content = [[PCToolMakefileFactory sharedFactory] makefileForProject:self])) {
NSLog([NSString stringWithFormat:@"Couldn't build the GNUmakefile %@!",makefile]);
return NO;
}
if (![content writeToFile:makefile atomically:YES]) {
NSLog([NSString stringWithFormat:@"Couldn't write the GNUmakefile %@!",makefile]);
return NO;
}
return YES;
return NO;
}
- (BOOL)isValidDictionary:(NSDictionary *)aDict