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