mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Fmt
This commit is contained in:
parent
a32d3aef87
commit
54018f9773
3 changed files with 18 additions and 7 deletions
|
|
@ -44,8 +44,8 @@ pub fn free_file(mut path: PathBuf) -> PathBuf {
|
|||
let ext = path.extension().unwrap().to_string_lossy();
|
||||
let mut filename = path.file_stem().unwrap().to_str().unwrap();
|
||||
|
||||
if filename.ends_with(&format!(" ({})", i-1)) {
|
||||
filename = filename.strip_suffix(&format!(" ({})", i-1)).unwrap();
|
||||
if filename.ends_with(&format!(" ({})", i - 1)) {
|
||||
filename = filename.strip_suffix(&format!(" ({})", i - 1)).unwrap();
|
||||
}
|
||||
|
||||
path.set_file_name(format!("{} ({}).{}", filename, i, ext))
|
||||
|
|
@ -55,5 +55,7 @@ pub fn free_file(mut path: PathBuf) -> PathBuf {
|
|||
|
||||
/// Sanitizes the given path to not contain any invalid file character.
|
||||
pub fn sanitize_file(path: PathBuf) -> PathBuf {
|
||||
path.with_file_name(sanitize_filename::sanitize(path.file_name().unwrap().to_string_lossy()))
|
||||
path.with_file_name(sanitize_filename::sanitize(
|
||||
path.file_name().unwrap().to_string_lossy(),
|
||||
))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue