From c574c7cae441d1e69c6f8ee6b2124b6e6cfba313 Mon Sep 17 00:00:00 2001 From: "Philippe C.D. Robert" Date: Sat, 29 Dec 2001 14:07:39 +0000 Subject: [PATCH] leaned up the writeMakefile method git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@11909 72102866-910b-0410-8b05-ffd578937521 --- PCLibProj/PCLibProject.m | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/PCLibProj/PCLibProject.m b/PCLibProj/PCLibProject.m index 18d7f71..3d55547 100644 --- a/PCLibProj/PCLibProject.m +++ b/PCLibProj/PCLibProject.m @@ -87,26 +87,19 @@ - (BOOL)writeMakefile { NSFileManager *fm = [NSFileManager defaultManager]; - NSString *makefile = [[self 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 = [[PCLibMakefileFactory 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 = [[PCLibMakefileFactory 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