Skip to content

Commit b6309a9

Browse files
committed
F some
1 parent c8fea57 commit b6309a9

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

brewkit/fixup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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) {

brewkit/fixups/empty-dir-pruner.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,29 @@ import Path from "../path.ts";
22

33
export 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
}

0 commit comments

Comments
 (0)