File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -68,12 +68,11 @@ const junkFilesDesktop = [
68
68
"**.cpp" ,
69
69
"**.hpp" ,
70
70
"**.typed" ,
71
- "**.a" ,
72
- "**.pdb" ,
73
71
"**.pyi" ,
74
72
"**.pxd" ,
75
73
"**.pyx" ,
76
- "**/LICENSE" ,
74
+ "**.a" ,
75
+ "**.pdb" ,
77
76
"**.dist-info" ,
78
77
"**/__pycache__" ,
79
78
];
@@ -461,21 +460,30 @@ class PackageCommand extends Command {
461
460
}
462
461
463
462
Future <void > cleanupDir (Directory directory, List <String > filesGlobs) async {
464
- return cleanupDirRecursive (
463
+ await cleanupDirRecursive (
465
464
directory, filesGlobs.map ((g) => Glob (g.replaceAll ("\\ " , "/" ))));
466
465
}
467
466
468
- Future <void > cleanupDirRecursive (
467
+ Future <bool > cleanupDirRecursive (
469
468
Directory directory, Iterable <Glob > globs) async {
469
+ var emptyDir = true ;
470
470
for (var entity in directory.listSync ()) {
471
471
if (globs.any ((g) => g.matches (entity.path.replaceAll ("\\ " , "/" ))) &&
472
472
await entity.exists ()) {
473
473
verbose ("Deleting ${entity .path }" );
474
474
await entity.delete (recursive: true );
475
475
} else if (entity is Directory ) {
476
- await cleanupDirRecursive (entity, globs);
476
+ if (await cleanupDirRecursive (entity, globs)) {
477
+ verbose ("Deleting empty directory ${entity .path }" );
478
+ await entity.delete (recursive: true );
479
+ } else {
480
+ emptyDir = false ;
481
+ }
482
+ } else {
483
+ emptyDir = false ;
477
484
}
478
485
}
486
+ return emptyDir;
479
487
}
480
488
481
489
Future <int > runExec (String execPath, List <String > args,
You can’t perform that action at this time.
0 commit comments