File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ fn get_temp_path(path: &Path) -> PathBuf {
1414 let file_name = path. file_name ( ) . and_then ( |n| n. to_str ( ) ) . unwrap_or ( "temp" ) ;
1515 let unique_id = COUNTER . fetch_add ( 1 , Ordering :: Relaxed ) ;
1616 let pid = std:: process:: id ( ) ;
17- temp_path. set_file_name ( format ! ( "tmp_{}_{}_{}_ .tmp" , file_name, pid, unique_id) ) ;
17+ temp_path. set_file_name ( format ! ( ".{}.{}.{} .tmp" , file_name, pid, unique_id) ) ;
1818 temp_path
1919}
2020
@@ -75,10 +75,10 @@ mod tests {
7575 // Check temp file is in same directory as original
7676 assert_eq ! ( temp1. parent( ) , path. parent( ) ) ;
7777
78- // Check temp file name starts with tmp_ and ends with .tmp
78+ // Check temp file name starts with dot and ends with .tmp
7979 let file_name = temp1. file_name ( ) . unwrap ( ) . to_string_lossy ( ) ;
80- assert ! ( file_name. starts_with( "tmp_file.dat_ " ) ) ;
81- assert ! ( file_name. ends_with( "_ .tmp" ) ) ;
80+ assert ! ( file_name. starts_with( ".file.dat. " ) ) ;
81+ assert ! ( file_name. ends_with( ".tmp" ) ) ;
8282 }
8383
8484 #[ tokio:: test]
You can’t perform that action at this time.
0 commit comments