@@ -21,23 +21,15 @@ Author: CM Wintersteiger, 2006
2121
2222#include < iostream>
2323
24- #include < util/message.h>
25- #include < util/prefix.h>
2624#include < util/config.h>
25+ #include < util/file_util.h>
2726#include < util/get_base_name.h>
27+ #include < util/message.h>
28+ #include < util/prefix.h>
2829
2930#include " compile.h"
3031
3132// / does it.
32- static bool is_directory (const std::string &s)
33- {
34- if (s.empty ())
35- return false ;
36- char last_char=s[s.size ()-1 ];
37- // Visual CL recognizes both
38- return last_char==' \\ ' || last_char==' /' ;
39- }
40-
4133int ms_cl_modet::doit ()
4234{
4335 if (cmdline.isset (' ?' ) ||
@@ -103,24 +95,26 @@ int ms_cl_modet::doit()
10395
10496 if (cmdline.isset (" Fo" ))
10597 {
106- compiler. output_file_object = cmdline.get_value (" Fo" );
98+ std::string Fo_value = cmdline.get_value (" Fo" );
10799
108- // this could be a directory
109- if (is_directory (compiler. output_file_object ) &&
110- cmdline. args . size ()>= 1 )
111- compiler. output_file_object +=
112- get_base_name (cmdline. args [ 0 ], true )+ " .obj " ;
100+ // this could be a directory or a file name
101+ if (is_directory (Fo_value))
102+ compiler. output_directory_object = Fo_value;
103+ else
104+ compiler. output_file_object = Fo_value ;
113105 }
114106
115107 if (cmdline.isset (" Fe" ))
116108 {
117109 compiler.output_file_executable =cmdline.get_value (" Fe" );
118110
119111 // this could be a directory
120- if (is_directory (compiler.output_file_executable ) &&
121- cmdline.args .size ()>=1 )
122- compiler.output_file_executable +=
123- get_base_name (cmdline.args [0 ], true )+" .exe" ;
112+ if (
113+ is_directory (compiler.output_file_executable ) &&
114+ cmdline.args .size () >= 1 )
115+ compiler.output_file_executable = concat_dir_file (
116+ compiler.output_file_executable ,
117+ get_base_name (cmdline.args [0 ], true ) + " .exe" );
124118 }
125119 else
126120 {
0 commit comments