Skip to content

Commit bcf8af3

Browse files
committed
refactor: reuse utils
1 parent 5dbae17 commit bcf8af3

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/providers/filesystem.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type FSWatcher, watch as watchSync } from 'node:fs';
22
import { readFile, rename, stat, unlink } from 'node:fs/promises';
33
import * as vscode from 'vscode';
44
import { osacompileFromSource, osadecompile } from '../osa.ts';
5-
import { scptUriToFileUri } from '../util.ts';
5+
import { fileExists, scptUriToFileUri } from '../util.ts';
66

77
/**
88
* Virtual FileSystemProvider for binary AppleScript (.scpt) files
@@ -111,10 +111,7 @@ export class ScptFileSystemProvider implements vscode.FileSystemProvider {
111111
const filePath = fileUri.fsPath;
112112

113113
try {
114-
// Check if file exists
115-
const exists = await stat(filePath)
116-
.then(() => true)
117-
.catch(() => false);
114+
const exists = await fileExists(filePath);
118115

119116
if (!exists && !options.create) {
120117
throw vscode.FileSystemError.FileNotFound(uri);

0 commit comments

Comments
 (0)