File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -279,19 +279,17 @@ pub fn gen_custom_dir() -> Result<(PathBuf, Uuid)> {
279279}
280280
281281pub async fn import_chart_to ( dir : & Path , id : Uuid , path : String ) -> Result < LocalChart > {
282- let path_str = path. clone ( ) ;
283- let path = Path :: new ( & path_str) ;
282+ let path = Path :: new ( & path) ;
284283 if !path. exists ( ) || !path. is_file ( ) {
285284 bail ! ( "not a file" ) ;
286285 }
287- let dir_obj = prpr:: dir:: Dir :: new ( dir) ?;
288- unzip_into ( BufReader :: new ( File :: open ( path) ?) , & dir_obj, true ) ?;
289- let _ = std:: fs:: remove_file ( path) ;
286+ let dir = prpr:: dir:: Dir :: new ( dir) ?;
287+ unzip_into ( BufReader :: new ( File :: open ( path) ?) , & dir, true ) ?;
290288 let local_path = format ! ( "custom/{id}" ) ;
291289 let mut fs = fs_from_path ( & local_path) ?;
292290 let mut info = fs:: load_info ( fs. as_mut ( ) ) . await . with_context ( || itl ! ( "info-fail" ) ) ?;
293291 fs:: fix_info ( fs. as_mut ( ) , & mut info) . await . with_context ( || itl ! ( "invalid-chart" ) ) ?;
294- dir_obj . create ( "info.yml" ) ?. write_all ( serde_yaml:: to_string ( & info) ?. as_bytes ( ) ) ?;
292+ dir . create ( "info.yml" ) ?. write_all ( serde_yaml:: to_string ( & info) ?. as_bytes ( ) ) ?;
295293 Ok ( LocalChart {
296294 info : info. into ( ) ,
297295 local_path,
You can’t perform that action at this time.
0 commit comments