@@ -184,14 +184,16 @@ Studio 2013 and during install select the "C++ tools":
184
184
185
185
_Install the C++ build tools before proceeding_.
186
186
187
- If you will be targetting the GNU ABI or otherwise know what you are
187
+ If you will be targeting the GNU ABI or otherwise know what you are
188
188
doing then it is fine to continue installation without the build
189
189
tools, but otherwise, install the C++ build tools before proceeding.
190
190
"# ;
191
191
192
192
static TOOLS : & ' static [ & ' static str ]
193
193
= & [ "rustc" , "rustdoc" , "cargo" , "rust-lldb" , "rust-gdb" , "rls" ] ;
194
194
195
+ static DUP_TOOLS : & ' static [ & ' static str ] = & [ "rustfmt" , "cargo-fmt" ] ;
196
+
195
197
static UPDATE_ROOT : & ' static str
196
198
= "https://static.rust-lang.org/rustup" ;
197
199
@@ -652,6 +654,18 @@ fn install_bins() -> Result<()> {
652
654
let ref tool_path = bin_path. join ( & format ! ( "{}{}" , tool, EXE_SUFFIX ) ) ;
653
655
try!( utils:: hard_or_symlink_file ( rustup_path, tool_path) ) ;
654
656
}
657
+ for tool in DUP_TOOLS {
658
+ let ref token_path = bin_path. join ( & format ! ( "{}.rustup" , tool) ) ;
659
+ let ref tool_path = bin_path. join ( & format ! ( "{}{}" , tool, EXE_SUFFIX ) ) ;
660
+ if tool_path. exists ( ) && !token_path. exists ( ) {
661
+ warn ! ( "tool `{}` is already installed, remove it from `{}`, then run `rustup update` \
662
+ to have rustup manage this tool.",
663
+ tool, bin_path. to_string_lossy( ) ) ;
664
+ } else {
665
+ try!( utils:: hard_or_symlink_file ( rustup_path, tool_path) ) ;
666
+ try!( utils:: write_file ( "<token file>" , token_path, "" ) ) ;
667
+ }
668
+ }
655
669
656
670
Ok ( ( ) )
657
671
}
@@ -752,7 +766,7 @@ pub fn uninstall(no_prompt: bool) -> Result<()> {
752
766
753
767
// Then everything in bin except rustup and tools. These can't be unlinked
754
768
// until this process exits (on windows).
755
- let tools = TOOLS . iter ( ) . map ( |t| format ! ( "{}{}" , t, EXE_SUFFIX ) ) ;
769
+ let tools = TOOLS . iter ( ) . chain ( DUP_TOOLS . iter ( ) ) . map ( |t| format ! ( "{}{}" , t, EXE_SUFFIX ) ) ;
756
770
let tools: Vec < _ > = tools. chain ( vec ! [ format!( "rustup{}" , EXE_SUFFIX ) ] ) . collect ( ) ;
757
771
for dirent in try!( fs:: read_dir ( & cargo_home. join ( "bin" ) ) . chain_err ( || read_dir_err) ) {
758
772
let dirent = try!( dirent. chain_err ( || read_dir_err) ) ;
0 commit comments