@@ -94,6 +94,8 @@ const SYSTEM_DIRECTORIES: &[&str] = &[
9494 ".Trashes" ,
9595 // Linux
9696 "lost+found" ,
97+ // NAS
98+ "#Recycle" ,
9799] ;
98100
99101/// Return the path to the user config file.
@@ -1237,6 +1239,60 @@ mod system_directory_tests {
12371239 }
12381240 }
12391241 }
1242+
1243+ #[ test]
1244+ fn is_system_directory_nas_recycle ( ) {
1245+ let dir = tempdir ( ) . unwrap ( ) ;
1246+ let recycle = dir. path ( ) . join ( "#recycle" ) ;
1247+ std:: fs:: create_dir ( & recycle) . unwrap ( ) ;
1248+
1249+ for entry in WalkDir :: new ( dir. path ( ) ) . min_depth ( 1 ) {
1250+ let entry = entry. unwrap ( ) ;
1251+ if entry. file_name ( ) . to_string_lossy ( ) == "#recycle" {
1252+ assert ! ( is_system_directory( & entry) ) ;
1253+ }
1254+ }
1255+ }
1256+
1257+ #[ test]
1258+ fn is_system_directory_nas_recycle_mixed_case ( ) {
1259+ let dir = tempdir ( ) . unwrap ( ) ;
1260+ let recycle = dir. path ( ) . join ( "#Recycle" ) ;
1261+ std:: fs:: create_dir ( & recycle) . unwrap ( ) ;
1262+
1263+ for entry in WalkDir :: new ( dir. path ( ) ) . min_depth ( 1 ) {
1264+ let entry = entry. unwrap ( ) ;
1265+ if entry. file_name ( ) . to_string_lossy ( ) == "#Recycle" {
1266+ assert ! ( is_system_directory( & entry) ) ;
1267+ }
1268+ }
1269+ }
1270+
1271+ #[ test]
1272+ fn is_system_directory_path_nas_recycle ( ) {
1273+ let path = Path :: new ( "/volume1/share/#recycle" ) ;
1274+ assert ! ( is_system_directory_path( path) ) ;
1275+ }
1276+
1277+ #[ test]
1278+ fn is_system_directory_path_nas_recycle_mixed_case ( ) {
1279+ let path = Path :: new ( "/volume1/share/#Recycle" ) ;
1280+ assert ! ( is_system_directory_path( path) ) ;
1281+ }
1282+
1283+ #[ test]
1284+ fn should_skip_entry_nas_recycle ( ) {
1285+ let dir = tempdir ( ) . unwrap ( ) ;
1286+ let recycle = dir. path ( ) . join ( "#recycle" ) ;
1287+ std:: fs:: create_dir ( & recycle) . unwrap ( ) ;
1288+
1289+ for entry in WalkDir :: new ( dir. path ( ) ) . min_depth ( 1 ) {
1290+ let entry = entry. unwrap ( ) ;
1291+ if entry. file_name ( ) . to_string_lossy ( ) == "#recycle" {
1292+ assert ! ( should_skip_entry( & entry) ) ;
1293+ }
1294+ }
1295+ }
12401296}
12411297
12421298#[ cfg( test) ]
0 commit comments