output bug fixed

This commit is contained in:
ascendforever 2023-10-24 18:52:33 -04:00
parent 57d664807b
commit aa74724295

View file

@ -205,7 +205,7 @@ fn format_pair(f1: &PathBuf, f2: &PathBuf, cfg: &Config) -> String {
let f2s = f2.to_string_lossy(); let f2s = f2.to_string_lossy();
if cfg.no_brace_output { if cfg.no_brace_output {
return format!( return format!(
"hardlinked {} {}\n", "{} {}\n",
shlex::quote(&f1s), shlex::quote(&f1s),
shlex::quote(&f2s) shlex::quote(&f2s)
) )
@ -217,7 +217,7 @@ fn format_pair(f1: &PathBuf, f2: &PathBuf, cfg: &Config) -> String {
let suffixlong = suffix.len() > 2; let suffixlong = suffix.len() > 2;
if prefixlong && suffixlong { if prefixlong && suffixlong {
format!( format!(
"hardlinked {}{{{},{}}}{}\n", "{}{{{},{}}}{}\n",
shlex::quote(prefix), shlex::quote(prefix),
shlex::quote(&f1s[ prefix.len()..std::cmp::max(prefix.len(), f1s.len()-suffix.len()) ]), shlex::quote(&f1s[ prefix.len()..std::cmp::max(prefix.len(), f1s.len()-suffix.len()) ]),
shlex::quote(&f2s[ prefix.len()..std::cmp::max(prefix.len(), f2s.len()-suffix.len()) ]), shlex::quote(&f2s[ prefix.len()..std::cmp::max(prefix.len(), f2s.len()-suffix.len()) ]),
@ -225,21 +225,21 @@ fn format_pair(f1: &PathBuf, f2: &PathBuf, cfg: &Config) -> String {
) )
} else if prefixlong { } else if prefixlong {
format!( format!(
"hardlinked {}{{{},{}}}\n", "{}{{{},{}}}\n",
shlex::quote(prefix), shlex::quote(prefix),
shlex::quote(&f1s[prefix.len()..]), shlex::quote(&f1s[prefix.len()..]),
shlex::quote(&f2s[prefix.len()..]) shlex::quote(&f2s[prefix.len()..])
) )
} else if suffixlong { } else if suffixlong {
format!( format!(
"hardlinked {{{},{}}}{}\n", "{{{},{}}}{}\n",
shlex::quote(&f1s[..f1s.len()-suffix.len()]), shlex::quote(&f1s[..f1s.len()-suffix.len()]),
shlex::quote(&f2s[..f2s.len()-suffix.len()]), shlex::quote(&f2s[..f2s.len()-suffix.len()]),
shlex::quote(suffix), shlex::quote(suffix),
) )
} else { } else {
format!( format!(
"hardlinked {} {}\n", "{} {}\n",
shlex::quote(&f1s), shlex::quote(&f1s),
shlex::quote(&f2s) shlex::quote(&f2s)
) )