Skip to content

Commit e39d835

Browse files
committed
Fix compilation of paths containing ".". Closes #821.
1 parent af61daf commit e39d835

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

src/comp/driver/rustc.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -517,35 +517,30 @@ fn main(args: vec[str]) {
517517
none. {
518518
// "-" as input file will cause the parser to read from stdin so we
519519
// have to make up a name
520+
// We want to toss everything after the final '.'
520521
let parts = if !input_is_stdin(ifile) {
521522
str::split(ifile, '.' as u8)
522523
} else {
523524
~["default", "rs"]
524525
};
525526
ivec::pop(parts);
526-
saved_out_filename = parts.(0);
527-
alt sopts.output_type {
528-
link::output_type_none. { parts += ~["none"]; }
529-
link::output_type_bitcode. { parts += ~["bc"]; }
530-
link::output_type_assembly. { parts += ~["s"]; }
531-
527+
saved_out_filename = str::connect(parts, ".");
528+
let suffix = alt sopts.output_type {
529+
link::output_type_none. { "none" }
530+
link::output_type_bitcode. { "bc" }
531+
link::output_type_assembly. { "s" }
532532
// Object and exe output both use the '.o' extension here
533-
link::output_type_object. {
534-
parts += ~["o"];
535-
}
536-
link::output_type_exe. { parts += ~["o"]; }
537-
}
538-
let ofile = str::connect(parts, ".");
533+
link::output_type_object. | link::output_type_exe. { "o" }
534+
};
535+
let ofile = saved_out_filename + "." + suffix;
539536
compile_input(sess, cfg, ifile, ofile);
540537
}
541538
some(ofile) {
542539
// FIXME: what about windows? This will create a foo.exe.o.
543-
544540
saved_out_filename = ofile;
545-
let temp_filename;
546-
if !stop_after_codegen {
547-
temp_filename = ofile + ".o";
548-
} else { temp_filename = ofile; }
541+
let temp_filename = if !stop_after_codegen {
542+
ofile + ".o"
543+
} else { ofile };
549544
compile_input(sess, cfg, ifile, temp_filename);
550545
}
551546
}

0 commit comments

Comments
 (0)