File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -105,9 +105,9 @@ export default async function default_fixups(
105105 }
106106 } else if ( isDirectory && name . endsWith ( ".dSYM" ) ) {
107107 rms . push ( path ) ;
108- } else {
109- pruner . add ( new Path ( path ) , isDirectory ) ;
110108 }
109+
110+ pruner . add ( new Path ( path ) , { isDirectory, isSymlink} ) ;
111111 }
112112
113113 for ( const shebang of shebangs ) {
Original file line number Diff line number Diff line change @@ -2,18 +2,29 @@ import Path from "../path.ts";
22
33export class EmptyDirectoryPruner {
44 candidates : Set < string > = new Set ( ) ;
5+ symlink_candidates : Set < string > = new Set ( ) ;
56
6- add ( p : Path , isDirectory : boolean ) {
7- if ( isDirectory ) {
7+ add ( p : Path , opts : { isDirectory : boolean , isSymlink : boolean } ) {
8+ if ( opts . isDirectory ) {
89 this . candidates . add ( p . string ) ;
910 }
11+ if ( opts . isSymlink ) {
12+ this . symlink_candidates . add ( p . string ) ;
13+ }
1014 }
1115
1216 async execute ( ) {
1317 for ( const dir of this . candidates ) {
1418 if ( new Path ( dir ) . isDirectory ( ) ) {
1519 try {
16- await Deno . remove ( dir ) ;
20+ Deno . removeSync ( dir ) ;
21+ } catch { }
22+ }
23+ }
24+ for ( const link of this . symlink_candidates ) {
25+ if ( ! new Path ( link ) . readlink ( ) . exists ( ) ) {
26+ try {
27+ Deno . removeSync ( link ) ;
1728 } catch { }
1829 }
1930 }
You can’t perform that action at this time.
0 commit comments