Author: rmottola
Date: Tue Mar  8 17:54:34 2016
New Revision: 39483

URL: http://svn.gna.org/viewcvs/gnustep?rev=39483&view=rev
Log:
Update debug executable path search to run, make it work on windows

Modified:
    apps/projectcenter/trunk/ChangeLog
    apps/projectcenter/trunk/Framework/PCProjectLauncher.m

Modified: apps/projectcenter/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/ChangeLog?rev=39483&r1=39482&r2=39483&view=diff
==============================================================================
--- apps/projectcenter/trunk/ChangeLog  (original)
+++ apps/projectcenter/trunk/ChangeLog  Tue Mar  8 17:54:34 2016
@@ -1,3 +1,8 @@
+2016-03-08 Riccardo Mottola <[email protected]>
+
+       * Framework/PCProjectLauncher.m
+       Update debug executable path search to run, make it work on windows.
+
 2015-11-09 Riccardo Mottola <[email protected]>
 
        * Framework/PCProjectInspector.m

Modified: apps/projectcenter/trunk/Framework/PCProjectLauncher.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Framework/PCProjectLauncher.m?rev=39483&r1=39482&r2=39483&view=diff
==============================================================================
--- apps/projectcenter/trunk/Framework/PCProjectLauncher.m      (original)
+++ apps/projectcenter/trunk/Framework/PCProjectLauncher.m      Tue Mar  8 
17:54:34 2016
@@ -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 @@
 
 - (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 @@
       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])
-    {
-      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];
-       }
-    }
-
-  if ([fm isExecutableFileAtPath:fp] == NO)
+#ifdef  __MINGW__
+  /* On windows we need to check the .exe file */
+  if ([[executablePath pathExtension] length] == 0)
+    {
+      executablePath = [executablePath stringByAppendingPathExtension: @"exe"];
+    }
+#endif
+
+  NSLog(@"debug executable launch path: %@", executablePath);
+  if ([fm isExecutableFileAtPath:executablePath] == NO)
     {
       NSRunAlertPanel(@"Debug",
                      @"No executable! Please build the project first.",
@@ -276,8 +281,8 @@
   // 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 @@
   NSString        *executablePath;
   NSFileManager   *fm;
 
-  executablePath = [NSMutableString stringWithString:[project projectPath]];
+  executablePath = [project projectPath];
 
   // Check if project type is executable
   if ([project isExecutable])


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to