Skip to content

Commit 13356fc

Browse files
committed
fix(config): satisfy path probe cleanup lint
1 parent 6de1b22 commit 13356fc

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

‎src/infra/path-case.ts‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,26 @@ function probeDirectoryWithTemporaryEntry(dir: string): boolean | undefined {
5858
const name = `.openclaw-case-probe-${randomUUID()}`;
5959
const probePath = path.join(dir, name);
6060
let created = false;
61+
let result: boolean | undefined;
6162
try {
6263
// An empty directory has no read-only lookup evidence. Use one exclusive,
6364
// zero-byte entry and remove it before config validation can continue.
6465
fs.writeFileSync(probePath, "", { flag: "wx", mode: 0o600 });
6566
created = true;
66-
return probeDirectoryEntry(dir, name);
67+
result = probeDirectoryEntry(dir, name);
6768
} catch {
68-
return undefined;
69-
} finally {
70-
if (created) {
71-
try {
72-
fs.unlinkSync(probePath);
73-
} catch (error) {
74-
if ((error as NodeJS.ErrnoException).code !== "ENOENT") {
75-
throw error;
76-
}
69+
result = undefined;
70+
}
71+
if (created) {
72+
try {
73+
fs.unlinkSync(probePath);
74+
} catch (error) {
75+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") {
76+
throw error;
7777
}
7878
}
7979
}
80+
return result;
8081
}
8182

8283
function defaultPathCaseInsensitive(): boolean {

0 commit comments

Comments
 (0)