@@ -116,16 +116,26 @@ impl<'a> InstallMethod<'a> {
116
116
117
117
try!( utils:: cmd_status ( "tar" , cmd) ) ;
118
118
119
+ // Find the root Rust folder within the subfolder
120
+ let root_dir = try!( try!( utils:: read_dir ( "install" , work_dir) )
121
+ . filter_map ( io:: Result :: ok)
122
+ . map ( |e| e. path ( ) )
123
+ . filter ( |p| utils:: is_directory ( & p) )
124
+ . next ( )
125
+ . ok_or ( Error :: InvalidInstaller ) ) ;
126
+
119
127
let mut cmd = Command :: new ( "sh" ) ;
120
128
cmd
121
- . arg ( installer_dir . join ( "install.sh" ) )
129
+ . arg ( root_dir . join ( "install.sh" ) )
122
130
. arg ( "--prefix" ) . arg ( & prefix. path ) ;
123
131
124
132
if prefix. install_type != InstallType :: Shared {
125
133
cmd. arg ( "--disable-ldconfig" ) ;
126
134
}
127
135
128
136
let result = utils:: cmd_status ( "sh" , cmd) ;
137
+
138
+ let _ = fs:: remove_dir_all ( & installer_dir) ;
129
139
130
140
if result. is_err ( ) && prefix. install_type == InstallType :: Owned {
131
141
let _ = fs:: remove_dir_all ( & prefix. path ) ;
@@ -153,7 +163,7 @@ impl<'a> InstallMethod<'a> {
153
163
. filter ( |p| utils:: is_directory ( & p) )
154
164
. next ( )
155
165
. ok_or ( Error :: InvalidInstaller ) ) ;
156
-
166
+
157
167
// Rename and move it to the toolchain directory
158
168
utils:: rename_dir ( "install" , & root_dir, & prefix. path )
159
169
} ;
0 commit comments