added: #possiblyQuotedPath:
authorClaus Gittinger <cg@exept.de>
Tue, 09 Aug 2011 23:42:42 +0200
changeset 2658 92f1a346dbeb
parent 2657 158e4e722319
child 2659 315e8570246e
added: #possiblyQuotedPath: changed: #compileToC #compileToExe #compileToObj #compileToS all of those commands may have to deal with spaces in the filename
STCCompilerInterface.st
--- a/STCCompilerInterface.st	Tue Aug 09 23:27:03 2011 +0200
+++ b/STCCompilerInterface.st	Tue Aug 09 23:42:42 2011 +0200
@@ -378,8 +378,9 @@
 
     |command errorStream ok|
 
-    command := stcPath , ' ' , stcFlags , ' -defdir=', cFileName asFilename directory pathName,
-                                          ' -C ' , (stFileName asFilename pathName).
+    command := (self possiblyQuotedPath:stcPath) , ' ' , stcFlags 
+                , ' -defdir=', (self possiblyQuotedPath:cFileName asFilename directory pathName),
+                ' -C ' , (self possiblyQuotedPath:stFileName asFilename pathName).
     errorStream := 'errorOutput' asFilename writeStream.
 
     Verbose == true ifTrue:[
@@ -423,7 +424,7 @@
 
     errorStream := 'errorOutput' asFilename newReadWriteStream.
 
-    command := ccPath , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ ' , cFileName.
+    command := (self possiblyQuotedPath:ccPath) , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ ' , (self possiblyQuotedPath:cFileName).
 
     Verbose == true ifTrue:[
         'executing: ' infoPrint. command infoPrintCR.
@@ -452,17 +453,13 @@
 compileToObj
     "compile C to obj, using cc"
 
-    |command errorStream ok|
+    |errorStream ok command|
 
     errorStream := 'errorOutput' asFilename newReadWriteStream.
 
-    ccPath includesSeparator ifTrue:[
-        command := '"',ccPath , '"' 
-    ] ifFalse:[
-        command := ccPath
-    ].
     "Note: Windows/bcc32 does not understand a space between -o and filename"
-    command := command , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ -o', oFileName, ' -c ' , cFileName.
+    "/ cg: I guess, this does not work for visual-c
+    command := (self possiblyQuotedPath:ccPath) , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ -o', (self possiblyQuotedPath:oFileName), ' -c ' , (self possiblyQuotedPath:cFileName).
 
     Verbose == true ifTrue:[
         'executing: ' infoPrint. command infoPrintCR.
@@ -508,7 +505,7 @@
 
     errorStream := 'errorOutput' asFilename newReadWriteStream.
 
-    command := ccPath , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ -S ' , cFileName.
+    command := (self possiblyQuotedPath:ccPath) , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ -S ' , (self possiblyQuotedPath:cFileName).
 
     Verbose == true ifTrue:[
         'executing: ' infoPrint. command infoPrintCR.
@@ -714,6 +711,15 @@
     "Modified: / 08-08-2011 / 23:23:10 / cg"
 !
 
+possiblyQuotedPath:aPath
+    (aPath includes:$ ) ifTrue:[
+        (aPath startsWith:'"') ifFalse:[
+            ^ '"',aPath,'"'
+        ]
+    ].
+    ^ aPath
+!
+
 reportCompilationError
     |eMsg errorMessages lNr|
 
@@ -841,11 +847,11 @@
 !STCCompilerInterface class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/STCCompilerInterface.st,v 1.24 2011-08-09 12:59:38 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/STCCompilerInterface.st,v 1.25 2011-08-09 21:42:42 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/STCCompilerInterface.st,v 1.24 2011-08-09 12:59:38 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/STCCompilerInterface.st,v 1.25 2011-08-09 21:42:42 cg Exp $'
 ! !
 
 STCCompilerInterface initialize!