Update debug executable path search to run, make it work on windows

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@39483 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2016-03-08 16:54:34 +00:00
parent e0617baf52
commit 372a9c4b82
2 changed files with 40 additions and 30 deletions

View file

@ -1,3 +1,8 @@
2016-03-08 Riccardo Mottola <rm@gnu.org>
* Framework/PCProjectLauncher.m
Update debug executable path search to run, make it work on windows.
2015-11-09 Riccardo Mottola <rm@gnu.org>
* Framework/PCProjectInspector.m

View file

@ -1,10 +1,11 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2000-2014 Free Software Foundation
Copyright (C) 2000-2016 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Riccardo Mottola
This file is part of GNUstep.
@ -206,14 +207,33 @@ enum {
- (void)debug:(id)sender
{
NSString *projectName = [project projectName];
NSString *fp = nil;
NSString *executablePath;
NSString *gdbPath = nil;
NSFileManager *fm = [NSFileManager defaultManager];
PCBundleManager *bundleManager = [[project projectManager] bundleManager];
// Check if project type is executable
if (![project isExecutable])
executablePath = [project projectPath];
if ([project isExecutable])
{
NSString *prjType;
prjType = [project projectTypeName];
if ([prjType isEqualToString: @"Application"])
{
/* MyApplication.app/MyApplication */
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
executablePath = [executablePath stringByAppendingString:@".app"];
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
}
else if ([prjType isEqualToString: @"Tool"])
{
/* obj/MyTool */
executablePath = [executablePath stringByAppendingPathComponent:@"obj"];
executablePath = [executablePath stringByAppendingPathComponent:[project projectName]];
}
}
else
{
NSRunAlertPanel(@"Debug",
@"The project is not executable",
@ -222,31 +242,16 @@ enum {
return;
}
/* We try in the order:
* xxx.debug/xxx (gnustep-make v1, application),
* xxx.app/xxx (gnustep-make v1 and v2, application),
* obj/xxx (gnustep-make v1 and v2, tool).
*/
fp = [project projectPath];
fp = [fp stringByAppendingPathComponent: [projectName stringByAppendingPathExtension: @"debug"]];
fp = [fp stringByAppendingPathComponent: projectName];
if (! [fm isExecutableFileAtPath: fp])
#ifdef __MINGW__
/* On windows we need to check the .exe file */
if ([[executablePath pathExtension] length] == 0)
{
fp = [project projectPath];
fp = [fp stringByAppendingPathComponent: [projectName stringByAppendingPathExtension: @"app"]];
fp = [fp stringByAppendingPathComponent: projectName];
if (! [fm isExecutableFileAtPath: fp])
{
fp = [project projectPath];
fp = [fp stringByAppendingPathComponent: @"obj"];
fp = [fp stringByAppendingPathComponent: projectName];
}
executablePath = [executablePath stringByAppendingPathExtension: @"exe"];
}
#endif
if ([fm isExecutableFileAtPath:fp] == NO)
NSLog(@"debug executable launch path: %@", executablePath);
if ([fm isExecutableFileAtPath:executablePath] == NO)
{
NSRunAlertPanel(@"Debug",
@"No executable! Please build the project first.",
@ -276,8 +281,8 @@ enum {
// Debugger
debugger = [bundleManager objectForBundleType: @"debugger"
protocol: @protocol(CodeDebugger)
fileName: [fp stringByDeletingLastPathComponent]];
[debugger debugExecutableAtPath: fp
fileName: [executablePath stringByDeletingLastPathComponent]];
[debugger debugExecutableAtPath: executablePath
withDebugger: gdbPath];
// turn debug button off...
@ -292,7 +297,7 @@ enum {
NSString *executablePath;
NSFileManager *fm;
executablePath = [NSMutableString stringWithString:[project projectPath]];
executablePath = [project projectPath];
// Check if project type is executable
if ([project isExecutable])