mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-02-20 18:32:17 +00:00
alert dialogs with one button
This commit is contained in:
parent
3b79ef470f
commit
e59caf9e26
8 changed files with 249 additions and 59 deletions
|
@ -391,7 +391,8 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
PCFileManager *pcfm = [PCFileManager defaultManager];
|
PCFileManager *pcfm = [PCFileManager defaultManager];
|
||||||
NSArray *_srcExtensionArray = [NSArray arrayWithObjects: @"m",nil];
|
NSArray *_srcExtensionArray = [NSArray arrayWithObjects: @"m",nil];
|
||||||
NSArray *_hdrExtensionArray = [NSArray arrayWithObjects: @"h",nil];
|
NSArray *_hdrExtensionArray = [NSArray arrayWithObjects: @"h",nil];
|
||||||
NSArray *_otherSrcsExtensionArray = [NSArray arrayWithObjects: @"c",nil];
|
NSArray *_otherSrcsExtensionArray = [NSArray arrayWithObjects: @"c", @"original",nil];
|
||||||
|
NSArray *_interfaceFileExtensionArray = [NSArray arrayWithObjects: @"gorm", @"gsmarkup", nil];
|
||||||
NSMutableArray *_srcFiles = [[NSMutableArray alloc] init];
|
NSMutableArray *_srcFiles = [[NSMutableArray alloc] init];
|
||||||
NSMutableArray *_hdrFiles = [[NSMutableArray alloc] init];
|
NSMutableArray *_hdrFiles = [[NSMutableArray alloc] init];
|
||||||
NSMutableArray *_otherSrcFiles = [[NSMutableArray alloc] init];
|
NSMutableArray *_otherSrcFiles = [[NSMutableArray alloc] init];
|
||||||
|
@ -400,6 +401,7 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
[pcfm findFilesAt: path withExtensions: _srcExtensionArray into: _srcFiles];
|
[pcfm findFilesAt: path withExtensions: _srcExtensionArray into: _srcFiles];
|
||||||
[pcfm findFilesAt: path withExtensions: _hdrExtensionArray into: _hdrFiles];
|
[pcfm findFilesAt: path withExtensions: _hdrExtensionArray into: _hdrFiles];
|
||||||
[pcfm findFilesAt: path withExtensions: _otherSrcsExtensionArray into: _otherSrcFiles];
|
[pcfm findFilesAt: path withExtensions: _otherSrcsExtensionArray into: _otherSrcFiles];
|
||||||
|
[pcfm findFilesAt: path withExtensions: _interfaceFileExtensionArray into: _gormFiles];
|
||||||
|
|
||||||
if (DLSA_DEBUG) {
|
if (DLSA_DEBUG) {
|
||||||
// print the array of files
|
// print the array of files
|
||||||
|
@ -411,8 +413,11 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
for (idx = 0; idx < [_hdrFiles count]; idx++) {
|
for (idx = 0; idx < [_hdrFiles count]; idx++) {
|
||||||
printf("%s\n", [[_hdrFiles objectAtIndex: idx] cString]);
|
printf("%s\n", [[_hdrFiles objectAtIndex: idx] cString]);
|
||||||
}
|
}
|
||||||
for (idx = 0; idx < [[projectDict objectForKey: PCOtherSources] count]; idx++) {
|
for (idx = 0; idx < [_otherSrcFiles count]; idx++) {
|
||||||
printf("%s\n", [[[projectDict objectForKey: PCOtherSources] objectAtIndex: idx] cString]);
|
printf("%s\n", [[_otherSrcFiles objectAtIndex: idx] cString]);
|
||||||
|
}
|
||||||
|
for (idx = 0; idx < [_gormFiles count]; idx++) {
|
||||||
|
printf("%s\n", [[_gormFiles objectAtIndex: idx] cString]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,21 +427,6 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
otherSrcs = [otherSrcs arrayByAddingObjectsFromArray: _otherSrcFiles];
|
otherSrcs = [otherSrcs arrayByAddingObjectsFromArray: _otherSrcFiles];
|
||||||
[projectDict setObject: otherSrcs forKey: PCOtherSources];
|
[projectDict setObject: otherSrcs forKey: PCOtherSources];
|
||||||
[projectDict setObject: _gormFiles forKey: PCInterfaces];
|
[projectDict setObject: _gormFiles forKey: PCInterfaces];
|
||||||
|
|
||||||
if (DLSA_DEBUG) {
|
|
||||||
// print the array of files
|
|
||||||
printf("---------------------------------\n");
|
|
||||||
int idx;
|
|
||||||
for (idx = 0; idx < [_srcFiles count]; idx++) {
|
|
||||||
printf("%s\n", [[_srcFiles objectAtIndex: idx] cString]);
|
|
||||||
}
|
|
||||||
for (idx = 0; idx < [_hdrFiles count]; idx++) {
|
|
||||||
printf("%s\n", [[_hdrFiles objectAtIndex: idx] cString]);
|
|
||||||
}
|
|
||||||
for (idx = 0; idx < [otherSrcs count]; idx++) {
|
|
||||||
printf("%s\n", [[otherSrcs objectAtIndex: idx] cString]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) processMakefile: (NSMutableDictionary*)projectDict scanningFrom: (NSString*) path {
|
- (BOOL) processMakefile: (NSMutableDictionary*)projectDict scanningFrom: (NSString*) path {
|
||||||
|
@ -473,9 +463,11 @@ NSString *PCActiveProjectDidChangeNotification = @"PCActiveProjectDidChange";
|
||||||
NSFileManager *fm = [NSFileManager defaultManager];
|
NSFileManager *fm = [NSFileManager defaultManager];
|
||||||
NSString *fromFullPath = [NSString pathWithComponents: oldFileNamePath];
|
NSString *fromFullPath = [NSString pathWithComponents: oldFileNamePath];
|
||||||
NSString *toFullPath = [NSString pathWithComponents: newFileNamePath];
|
NSString *toFullPath = [NSString pathWithComponents: newFileNamePath];
|
||||||
BOOL _moveResult = YES;
|
BOOL _moveResult = NO;
|
||||||
NSError *error;
|
NSError *error;
|
||||||
_moveResult = [fm moveItemAtPath: fromFullPath toPath: toFullPath error: &error];
|
if ([fm fileExistsAtPath: fromFullPath isDirectory: NO]) {
|
||||||
|
_moveResult = [fm moveItemAtPath: fromFullPath toPath: toFullPath error: &error];
|
||||||
|
}
|
||||||
return _moveResult;
|
return _moveResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,52 @@
|
||||||
|
|
||||||
// dlsa - addFromSources
|
// dlsa - addFromSources
|
||||||
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
||||||
|
|
||||||
|
PCFileManager *pcfm = [PCFileManager defaultManager];
|
||||||
|
NSString *_file;
|
||||||
|
NSBundle *projectBundle;
|
||||||
|
BOOL _moveResult = YES;
|
||||||
|
|
||||||
NSAssert(path,@"No valid project path provided!");
|
NSAssert(path,@"No valid project path provided!");
|
||||||
|
|
||||||
|
projectBundle = [NSBundle bundleForClass:[self class]];
|
||||||
|
|
||||||
|
[pcfm createDirectoriesIfNeededAtPath:path];
|
||||||
|
|
||||||
|
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
|
||||||
|
[projectDict initWithContentsOfFile:_file];
|
||||||
|
|
||||||
|
// Customise the project
|
||||||
|
[self setProjectPath:path];
|
||||||
|
[self setProjectName:[path lastPathComponent]];
|
||||||
|
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||||
|
{
|
||||||
|
projectName = [projectName stringByDeletingPathExtension];
|
||||||
|
}
|
||||||
|
[projectDict setObject:projectName forKey:PCProjectName];
|
||||||
|
[projectDict setObject:[[NSCalendarDate date] description]
|
||||||
|
forKey:PCCreationDate];
|
||||||
|
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
|
||||||
|
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
|
||||||
|
[projectDict setObject:[NSUserDefaults userLanguages] forKey:PCUserLanguages];
|
||||||
|
|
||||||
|
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
||||||
|
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
||||||
|
if (!_moveResult) {
|
||||||
|
NSRunAlertPanel(@"File Conflict",
|
||||||
|
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
||||||
|
@"Dismiss", nil, nil);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GNUmakefile.postamble
|
||||||
|
[[PCMakefileFactory sharedFactory] createPostambleForProject:self];
|
||||||
|
|
||||||
|
// Save the project to disc
|
||||||
|
if (_moveResult) {
|
||||||
|
[self writeMakefile];
|
||||||
|
}
|
||||||
|
[self save];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,6 @@
|
||||||
NSString *_2file = nil;
|
NSString *_2file = nil;
|
||||||
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
|
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
|
||||||
NSMutableArray *_array = nil;
|
NSMutableArray *_array = nil;
|
||||||
NSMutableArray *_subdirs = [[NSMutableArray alloc] init];
|
|
||||||
NSString *helpFile = nil;
|
NSString *helpFile = nil;
|
||||||
NSString *_executableFileName;
|
NSString *_executableFileName;
|
||||||
BOOL _moveResult = YES;
|
BOOL _moveResult = YES;
|
||||||
|
@ -318,15 +317,13 @@
|
||||||
|
|
||||||
// search for all .m and .h files and add them to the project
|
// search for all .m and .h files and add them to the project
|
||||||
[projectManager setSrcFilesOn: projectDict scanningFrom: path];
|
[projectManager setSrcFilesOn: projectDict scanningFrom: path];
|
||||||
[pcfm findDirectoriesAt: path into: _subdirs];
|
|
||||||
[projectDict setObject: _subdirs forKey: PCSubprojects];
|
|
||||||
|
|
||||||
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
||||||
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
||||||
if (!_moveResult) {
|
if (!_moveResult) {
|
||||||
NSRunAlertPanel(@"File Conflict",
|
NSRunAlertPanel(@"File Conflict",
|
||||||
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
@"The directory already contains a GNUmakefile file that cannot be moved.\nThe Project center makefiles will not be generated",
|
||||||
@"Dismiss", @"Dismiss", nil);
|
@"Dismiss",nil, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info-gnustep.plist
|
// Info-gnustep.plist
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#import <ProjectCenter/PCProject.h>
|
#import <ProjectCenter/PCProject.h>
|
||||||
#import <ProjectCenter/PCFileCreator.h>
|
#import <ProjectCenter/PCFileCreator.h>
|
||||||
#import <ProjectCenter/PCMakefileFactory.h>
|
#import <ProjectCenter/PCMakefileFactory.h>
|
||||||
|
// dlsa - create from sources
|
||||||
|
#import <ProjectCenter/PCProjectManager.h>
|
||||||
|
|
||||||
#import "PCBundleProject.h"
|
#import "PCBundleProject.h"
|
||||||
|
|
||||||
|
@ -161,6 +163,71 @@
|
||||||
|
|
||||||
// dlsa - addFromSources
|
// dlsa - addFromSources
|
||||||
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
||||||
|
NSBundle *projectBundle = nil;
|
||||||
|
NSString *_file = nil;
|
||||||
|
NSString *_2file = nil;
|
||||||
|
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
|
||||||
|
BOOL _moveResult = YES;
|
||||||
|
|
||||||
|
NSAssert(path,@"No valid project path provided!");
|
||||||
|
|
||||||
|
projectBundle = [NSBundle bundleForClass:[self class]];
|
||||||
|
|
||||||
|
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
|
||||||
|
[projectDict initWithContentsOfFile:_file];
|
||||||
|
|
||||||
|
// Customise the project
|
||||||
|
[self setProjectPath:path];
|
||||||
|
[self setProjectName:[path lastPathComponent]];
|
||||||
|
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||||
|
{
|
||||||
|
projectName = [projectName stringByDeletingPathExtension];
|
||||||
|
}
|
||||||
|
[projectDict setObject:projectName forKey:PCProjectName];
|
||||||
|
[projectDict setObject:projectName forKey:PCPrincipalClass];
|
||||||
|
[projectDict setObject:[[NSCalendarDate date] description]
|
||||||
|
forKey:PCCreationDate];
|
||||||
|
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
|
||||||
|
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
|
||||||
|
[projectDict setObject:[NSUserDefaults userLanguages] forKey:PCUserLanguages];
|
||||||
|
|
||||||
|
// Copy the project files to the provided path
|
||||||
|
|
||||||
|
// $PROJECTNAME$.m
|
||||||
|
_file = [NSString stringWithFormat:@"%@", projectName];
|
||||||
|
_2file = [NSString stringWithFormat:@"%@.m", projectName];
|
||||||
|
_moveResult = [projectManager moveFileNamed: _2file atPath: path toFileName: [_2file stringByAppendingString: @".original"]];
|
||||||
|
_moveResult = [projectManager moveFileNamed: [NSString stringWithFormat:@"%@.h", projectName]
|
||||||
|
atPath: path
|
||||||
|
toFileName: [[NSString stringWithFormat:@"%@.h", projectName] stringByAppendingString: @".original"]];
|
||||||
|
|
||||||
|
[pcfc createFileOfType:ObjCClass
|
||||||
|
path:[path stringByAppendingPathComponent:_file]
|
||||||
|
project:self];
|
||||||
|
|
||||||
|
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
|
||||||
|
_file = [NSString stringWithFormat:@"%@.h", projectName];
|
||||||
|
|
||||||
|
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
||||||
|
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
||||||
|
if (!_moveResult) {
|
||||||
|
NSRunAlertPanel(@"File Conflict",
|
||||||
|
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
||||||
|
@"Dismiss", nil, nil);
|
||||||
|
}
|
||||||
|
|
||||||
|
// search for all .m and .h files and add them to the project
|
||||||
|
[projectManager setSrcFilesOn: projectDict scanningFrom: path];
|
||||||
|
|
||||||
|
// GNUmakefile.postamble
|
||||||
|
[[PCMakefileFactory sharedFactory] createPostambleForProject:self];
|
||||||
|
|
||||||
|
// Save the project to disc
|
||||||
|
if (_moveResult) {
|
||||||
|
[self writeMakefile];
|
||||||
|
}
|
||||||
|
[self save];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,7 @@
|
||||||
// _resourcePath = [path stringByAppendingPathComponent:@"Resources"];
|
// _resourcePath = [path stringByAppendingPathComponent:@"Resources"];
|
||||||
|
|
||||||
// Save the project to disc
|
// Save the project to disc
|
||||||
|
|
||||||
[self writeMakefile];
|
[self writeMakefile];
|
||||||
[self save];
|
[self save];
|
||||||
|
|
||||||
|
@ -153,6 +154,73 @@
|
||||||
|
|
||||||
// dlsa - addFromSources
|
// dlsa - addFromSources
|
||||||
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
||||||
|
// PCFileManager *pcfm = [PCFileManager defaultManager];
|
||||||
|
PCFileCreator *pcfc = [PCFileCreator sharedCreator];
|
||||||
|
NSBundle *projectBundle = nil;
|
||||||
|
NSString *_file = nil;
|
||||||
|
NSString *_2file = nil;
|
||||||
|
// NSString *_resourcePath;
|
||||||
|
BOOL _moveResult = YES;
|
||||||
|
|
||||||
|
NSAssert(path,@"No valid project path provided!");
|
||||||
|
|
||||||
|
projectBundle = [NSBundle bundleForClass:[self class]];
|
||||||
|
|
||||||
|
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
|
||||||
|
[projectDict initWithContentsOfFile:_file];
|
||||||
|
|
||||||
|
// Customise the project
|
||||||
|
[self setProjectPath:path];
|
||||||
|
[self setProjectName:[path lastPathComponent]];
|
||||||
|
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||||
|
{
|
||||||
|
projectName = [projectName stringByDeletingPathExtension];
|
||||||
|
}
|
||||||
|
[projectDict setObject:projectName forKey:PCProjectName];
|
||||||
|
[projectDict setObject:[NSUserDefaults userLanguages] forKey:PCUserLanguages];
|
||||||
|
|
||||||
|
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
||||||
|
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
||||||
|
if (!_moveResult) {
|
||||||
|
NSRunAlertPanel(@"File Conflict",
|
||||||
|
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
||||||
|
@"Dismiss", @"Dismiss", nil);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the project files to the provided path
|
||||||
|
|
||||||
|
// $PROJECTNAME$.m
|
||||||
|
_file = [NSString stringWithFormat:@"%@", projectName];
|
||||||
|
_2file = [NSString stringWithFormat:@"%@.m", projectName];
|
||||||
|
_moveResult = [projectManager moveFileNamed: _2file atPath: path toFileName: [_2file stringByAppendingString: @".original"]];
|
||||||
|
_moveResult = [projectManager moveFileNamed: [NSString stringWithFormat:@"%@.h", projectName]
|
||||||
|
atPath: path
|
||||||
|
toFileName: [[NSString stringWithFormat:@"%@.h", projectName] stringByAppendingString: @".original"]];
|
||||||
|
|
||||||
|
[pcfc createFileOfType:ObjCClass
|
||||||
|
path:[path stringByAppendingPathComponent:_file]
|
||||||
|
project:self];
|
||||||
|
|
||||||
|
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
|
||||||
|
_file = [NSString stringWithFormat:@"%@.h", projectName];
|
||||||
|
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
|
||||||
|
forKey:PCPublicHeaders];
|
||||||
|
|
||||||
|
// search for all .m and .h files and add them to the project
|
||||||
|
[projectManager setSrcFilesOn: projectDict scanningFrom: path];
|
||||||
|
|
||||||
|
// GNUmakefile.postamble
|
||||||
|
[[PCMakefileFactory sharedFactory] createPostambleForProject:self];
|
||||||
|
|
||||||
|
// Resources
|
||||||
|
// _resourcePath = [path stringByAppendingPathComponent:@"Resources"];
|
||||||
|
|
||||||
|
// Save the project to disc
|
||||||
|
if (_moveResult) {
|
||||||
|
[self writeMakefile];
|
||||||
|
}
|
||||||
|
[self save];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,6 @@
|
||||||
NSString *_2file = nil;
|
NSString *_2file = nil;
|
||||||
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
|
NSBundle *projBundle = [NSBundle bundleForClass:[self class]];
|
||||||
NSString *_resourcePath = nil;
|
NSString *_resourcePath = nil;
|
||||||
NSMutableArray *_subdirs = [[NSMutableArray alloc] init];
|
|
||||||
BOOL _moveResult = YES;
|
BOOL _moveResult = YES;
|
||||||
|
|
||||||
NSAssert(path,@"No valid project path provided!");
|
NSAssert(path,@"No valid project path provided!");
|
||||||
|
@ -116,17 +115,12 @@
|
||||||
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
|
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
|
||||||
[projectDict setObject:[NSUserDefaults userLanguages] forKey:PCUserLanguages];
|
[projectDict setObject:[NSUserDefaults userLanguages] forKey:PCUserLanguages];
|
||||||
|
|
||||||
// search for all .m and .h files and add them to the project
|
|
||||||
[projectManager setSrcFilesOn: projectDict scanningFrom: path];
|
|
||||||
[pcfm findDirectoriesAt: path into: _subdirs];
|
|
||||||
[projectDict setObject: _subdirs forKey: PCSubprojects];
|
|
||||||
|
|
||||||
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
||||||
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
||||||
if (!_moveResult) {
|
if (!_moveResult) {
|
||||||
NSRunAlertPanel(@"File Conflict",
|
NSRunAlertPanel(@"File Conflict",
|
||||||
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
||||||
@"Dismiss", @"Dismiss", nil);
|
@"Dismiss", nil, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the project files to the provided path
|
// Copy the project files to the provided path
|
||||||
|
@ -135,31 +129,22 @@
|
||||||
_file = [NSString stringWithFormat:@"%@", projectName];
|
_file = [NSString stringWithFormat:@"%@", projectName];
|
||||||
_2file = [NSString stringWithFormat:@"%@.m", projectName];
|
_2file = [NSString stringWithFormat:@"%@.m", projectName];
|
||||||
_moveResult = [projectManager moveFileNamed: _2file atPath: path toFileName: [_2file stringByAppendingString: @".original"]];
|
_moveResult = [projectManager moveFileNamed: _2file atPath: path toFileName: [_2file stringByAppendingString: @".original"]];
|
||||||
if (!_moveResult) {
|
_moveResult = [projectManager moveFileNamed: [NSString stringWithFormat:@"%@.h", projectName]
|
||||||
NSRunAlertPanel(@"File Conflict",
|
atPath: path
|
||||||
[NSString stringWithFormat: @"The directory already contains a %@ file that cannot be moved. The Project center file will not be generated", _2file],
|
toFileName: [[NSString stringWithFormat:@"%@.h", projectName] stringByAppendingString: @".original"]];
|
||||||
@"Dismiss", @"Dismiss", nil);
|
|
||||||
} else {
|
[pcfc createFileOfType:ObjCClass
|
||||||
[pcfc createFileOfType:ObjCClass
|
path:[path stringByAppendingPathComponent:_file]
|
||||||
path:[path stringByAppendingPathComponent:_file]
|
project:self];
|
||||||
project:self];
|
|
||||||
[projectDict setObject:[NSArray arrayWithObjects:_2file,nil]
|
|
||||||
forKey:PCClasses];
|
|
||||||
}
|
|
||||||
|
|
||||||
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
|
// $PROJECTNAME$.h already created by creating $PROJECTNAME$.m
|
||||||
_file = [NSString stringWithFormat:@"%@.h", projectName];
|
_file = [NSString stringWithFormat:@"%@.h", projectName];
|
||||||
_moveResult = [projectManager moveFileNamed: _file atPath: path toFileName: [_file stringByAppendingString: @".original"]];
|
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
|
||||||
if (!_moveResult) {
|
forKey:PCPublicHeaders];
|
||||||
NSRunAlertPanel(@"File Conflict",
|
|
||||||
[NSString stringWithFormat: @"The directory already contains a %@ file that cannot be moved. The Project center file will not be generated", _2file],
|
// search for all .m and .h files and add them to the project
|
||||||
@"Dismiss", @"Dismiss", nil);
|
[projectManager setSrcFilesOn: projectDict scanningFrom: path];
|
||||||
} else {
|
|
||||||
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
|
|
||||||
forKey:PCHeaders];
|
|
||||||
[projectDict setObject:[NSArray arrayWithObjects:_file,nil]
|
|
||||||
forKey:PCPublicHeaders];
|
|
||||||
}
|
|
||||||
// GNUmakefile.postamble
|
// GNUmakefile.postamble
|
||||||
[[PCMakefileFactory sharedFactory] createPostambleForProject:self];
|
[[PCMakefileFactory sharedFactory] createPostambleForProject:self];
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,46 @@
|
||||||
|
|
||||||
// dlsa - addFromSources
|
// dlsa - addFromSources
|
||||||
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
||||||
|
NSBundle *projectBundle = nil;
|
||||||
|
NSString *_file = nil;
|
||||||
|
BOOL _moveResult = YES;
|
||||||
|
|
||||||
|
NSAssert(path,@"No valid project path provided!");
|
||||||
|
|
||||||
|
projectBundle = [NSBundle bundleForClass:[self class]];
|
||||||
|
|
||||||
|
_file = [projectBundle pathForResource:@"PC" ofType:@"project"];
|
||||||
|
[projectDict initWithContentsOfFile:_file];
|
||||||
|
|
||||||
|
// Customise the project
|
||||||
|
[self setProjectPath:path];
|
||||||
|
[self setProjectName:[path lastPathComponent]];
|
||||||
|
if ([[projectName pathExtension] isEqualToString:@"subproj"])
|
||||||
|
{
|
||||||
|
projectName = [projectName stringByDeletingPathExtension];
|
||||||
|
}
|
||||||
|
[projectDict setObject:projectName forKey:PCProjectName];
|
||||||
|
[projectDict setObject:[[NSCalendarDate date] description]
|
||||||
|
forKey:PCCreationDate];
|
||||||
|
[projectDict setObject:NSFullUserName() forKey:PCProjectCreator];
|
||||||
|
[projectDict setObject:NSFullUserName() forKey:PCProjectMaintainer];
|
||||||
|
[projectDict setObject:[NSUserDefaults userLanguages] forKey:PCUserLanguages];
|
||||||
|
|
||||||
|
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
||||||
|
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
||||||
|
if (!_moveResult) {
|
||||||
|
NSRunAlertPanel(@"File Conflict",
|
||||||
|
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
||||||
|
@"Dismiss", nil, nil);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GNUmakefile.postamble
|
||||||
|
[[PCMakefileFactory sharedFactory] createPostambleForProject:self];
|
||||||
|
|
||||||
|
// Save the project to disc
|
||||||
|
[self writeMakefile];
|
||||||
|
[self save];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,13 +209,11 @@
|
||||||
// dlsa - addFromSources
|
// dlsa - addFromSources
|
||||||
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
- (PCProject *)createProjectFromSourcesAt: (NSString *)path withOption: (NSString *)projOption {
|
||||||
|
|
||||||
PCFileManager *pcfm = [PCFileManager defaultManager];
|
|
||||||
NSBundle *projectBundle;
|
NSBundle *projectBundle;
|
||||||
NSString *_file;
|
NSString *_file;
|
||||||
NSString *_2file;
|
NSString *_2file;
|
||||||
NSMutableArray *_array = nil;
|
NSMutableArray *_array = nil;
|
||||||
NSString *_executableFileName;
|
NSString *_executableFileName;
|
||||||
NSMutableArray *_subdirs = [[NSMutableArray alloc] init];
|
|
||||||
BOOL _moveResult = YES;
|
BOOL _moveResult = YES;
|
||||||
|
|
||||||
NSAssert(path,@"No valid project path provided!");
|
NSAssert(path,@"No valid project path provided!");
|
||||||
|
@ -246,15 +244,13 @@
|
||||||
|
|
||||||
// search for all .m and .h files and add them to the project
|
// search for all .m and .h files and add them to the project
|
||||||
[projectManager setSrcFilesOn: projectDict scanningFrom: path];
|
[projectManager setSrcFilesOn: projectDict scanningFrom: path];
|
||||||
[pcfm findDirectoriesAt: path into: _subdirs];
|
|
||||||
[projectDict setObject: _subdirs forKey: PCSubprojects];
|
|
||||||
|
|
||||||
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
// move an existing GNUMakefile and create the one from the template and add other makefiles
|
||||||
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
_moveResult = [projectManager processMakefile: projectDict scanningFrom:path];
|
||||||
if (!_moveResult) {
|
if (!_moveResult) {
|
||||||
NSRunAlertPanel(@"File Conflict",
|
NSRunAlertPanel(@"File Conflict",
|
||||||
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
@"The directory already contains a GNUmakefile file that cannot be moved. The Project center makefiles will not be generated",
|
||||||
@"Dismiss", @"Dismiss", nil);
|
@"Dismiss", nil, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GNUmakefile.postamble
|
// GNUmakefile.postamble
|
||||||
|
|
Loading…
Reference in a new issue