@@ -756,14 +756,18 @@ fn cmd_uninstall(c: cargo) {
756756        ret; 
757757    } 
758758
759+     let  lib = c. libdir; 
760+     let  bin = c. bindir; 
759761    let  target = c. opts. free[ 2 u] ; 
760762
761763    // FIXME: needs stronger pattern matching 
764+     // FIXME: needs to uninstall from a specified location in a cache instead 
765+     // of looking for it (binaries can be uninstalled by name only) 
762766    if  is_uuid( target)  { 
763-         for  os:: list_dir( c . libdir ) . each {  |file|
767+         for  os:: list_dir( lib ) . each {  |file|
764768            alt str :: find_str( file,  "-" + target + "-")  { 
765769                some( idx)  { 
766-                     let  full = path:: normalize( path:: connect( c . libdir ,  file) ) ; 
770+                     let  full = path:: normalize( path:: connect( lib ,  file) ) ; 
767771                    if  os:: remove_file( full)  { 
768772                        info( "uninstalled:  ' " + full + "' ") ; 
769773                    }  else  { 
@@ -777,10 +781,25 @@ fn cmd_uninstall(c: cargo) {
777781
778782        error( "can' t find package with uuid:  " + target) ; 
779783    }  else  { 
780-         for  os:: list_dir( c . libdir ) . each {  |file|
784+         for  os:: list_dir( lib ) . each {  |file|
781785            alt str :: find_str( file,  "lib" + target + "-")  { 
782786                some( idx)  { 
783-                     let  full = path:: normalize( path:: connect( c. libdir,  file) ) ; 
787+                     let  full = path:: normalize( path:: connect( lib, 
788+                                file) ) ; 
789+                     if  os:: remove_file( full)  { 
790+                         info( "uninstalled:  ' " + full + "' ") ; 
791+                     }  else  { 
792+                         error( "could not uninstall:  ' " + full + "' ") ; 
793+                     } 
794+                     ret; 
795+                 } 
796+                 none {  cont;  } 
797+             } 
798+         } 
799+         for  os:: list_dir( bin) . each {  |file|
800+             alt str :: find_str( file,  target)  { 
801+                 some( idx)  { 
802+                     let  full = path:: normalize( path:: connect( bin,  file) ) ; 
784803                    if  os:: remove_file( full)  { 
785804                        info( "uninstalled:  ' " + full + "' ") ; 
786805                    }  else  { 
0 commit comments