diff --git a/ChangeLog b/ChangeLog index 304a2bf..e1761f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-03-08 Riccardo Mottola + + * Framework/PCProjectLauncher.m + Update debug executable path search to run, make it work on windows. + 2015-11-09 Riccardo Mottola * Framework/PCProjectInspector.m diff --git a/Framework/PCProjectLauncher.m b/Framework/PCProjectLauncher.m index db3ca46..08d7e83 100644 --- a/Framework/PCProjectLauncher.m +++ b/Framework/PCProjectLauncher.m @@ -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])