From 567dbdeb5bf764d13df94d09e514020d4ed63b7d Mon Sep 17 00:00:00 2001 From: Riccardo Mottola Date: Fri, 20 Sep 2013 09:17:55 +0000 Subject: [PATCH] Do not launch replacing if copying was not successful, avoids hang of app. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@37123 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 7 ++++++- Framework/PCFileCreator.m | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ca4204..ae8c0fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2013-09-17 Riccardo Mottola +2013-09-20 Riccardo Mottola + + * Framework/PCFileCreator.m + Do not launch replacing if copying was not successful, avoids hang of app. + +2013-09-17 Riccardo Mottola * Modules/Projects/ResourceSet/PCResourceSetProject.m Replace deprecated make variable. diff --git a/Framework/PCFileCreator.m b/Framework/PCFileCreator.m index 841ba51..5eb8573 100644 --- a/Framework/PCFileCreator.m +++ b/Framework/PCFileCreator.m @@ -1,10 +1,11 @@ /* GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html - Copyright (C) 2001-2004 Free Software Foundation + Copyright (C) 2001-2013 Free Software Foundation Authors: Philippe C.D. Robert Serg Stoyan + Riccardo Mottola This file is part of GNUstep. @@ -249,11 +250,13 @@ static NSDictionary *dict = nil; key = [fileType objectForKey:@"ProjectKey"]; template = [fileType objectForKey:@"TemplateFile"]; - [pcfm copyFile:template toFile:newFile]; - [self replaceTagsInFileAtPath:newFile withProject:aProject]; - [aProject addFiles:[NSArray arrayWithObject:newFile] - forKey:key - notify:YES]; + if ([pcfm copyFile:template toFile:newFile]) + { + [self replaceTagsInFileAtPath:newFile withProject:aProject]; + [aProject addFiles:[NSArray arrayWithObject:newFile] + forKey:key + notify:YES]; + } } // Notify the browser! @@ -319,7 +322,7 @@ static NSDictionary *dict = nil; } [file writeToFile:newFile atomically:YES]; - [file autorelease]; + [file release]; } @end @@ -440,9 +443,6 @@ static NSDictionary *dict = nil; NSFileManager *fm = [NSFileManager defaultManager]; BOOL complementary; -/* NSLog(@"PCFileCreator: [createFile] %@ in category: %@", - fileName, projectKey);*/ - path = [[activeProject projectPath] stringByAppendingPathComponent:fileName]; // Create file if (path)