File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,23 @@ pub fn write(path: &Path, contents: &str) -> Result<()> {
101
101
. chain_err ( || format ! ( "couldn't write to {}" , p) )
102
102
}
103
103
104
+ /// Escapes spaces (` `) in the given input with `%20` or does nothing. Then
105
+ /// it returns the processed string.
106
+ /// ### Windows Only
107
+ /// Doesn't do anything on non-windows systems because escaped output
108
+ /// (containing `\ `) is still treated as two arguments because of the
109
+ /// remaining space character.
104
110
pub fn escape_argument_spaces < S : Into < String > > ( arg : S ) -> String {
105
111
#[ cfg( target_os = "windows" ) ]
106
112
let escaped = arg. into ( ) . replace ( " " , "%20" ) ;
107
113
108
114
#[ cfg( not( target_os = "windows" ) ) ]
115
+ let escaped = arg. into ( ) ;
116
+ // Doesn't work because there's still a space character in the string
117
+ // and it's still interpreted as a separation between two arguments.
118
+ /*
109
119
let escaped = arg.into().replace(" ", "\\ ");
120
+ */
110
121
111
122
escaped
112
123
}
You can’t perform that action at this time.
0 commit comments