@@ -756,14 +756,18 @@ fn cmd_uninstall(c: cargo) {
756
756
ret;
757
757
}
758
758
759
+ let lib = c. libdir;
760
+ let bin = c. bindir;
759
761
let target = c. opts. free[ 2 u] ;
760
762
761
763
// 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)
762
766
if is_uuid( target) {
763
- for os:: list_dir( c . libdir ) . each { |file|
767
+ for os:: list_dir( lib ) . each { |file|
764
768
alt str :: find_str( file, "-" + target + "-") {
765
769
some( idx) {
766
- let full = path:: normalize( path:: connect( c . libdir , file) ) ;
770
+ let full = path:: normalize( path:: connect( lib , file) ) ;
767
771
if os:: remove_file( full) {
768
772
info( "uninstalled: ' " + full + "' ") ;
769
773
} else {
@@ -777,10 +781,25 @@ fn cmd_uninstall(c: cargo) {
777
781
778
782
error( "can' t find package with uuid: " + target) ;
779
783
} else {
780
- for os:: list_dir( c . libdir ) . each { |file|
784
+ for os:: list_dir( lib ) . each { |file|
781
785
alt str :: find_str( file, "lib" + target + "-") {
782
786
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) ) ;
784
803
if os:: remove_file( full) {
785
804
info( "uninstalled: ' " + full + "' ") ;
786
805
} else {
0 commit comments