change to asyn

This commit is contained in:
beyondkmp 2025-08-23 10:18:36 +08:00
parent cda0686f1d
commit b82a58f0ff

View File

@ -136,7 +136,13 @@ export class TesseractService {
private async _getCacheDir(): Promise<string> {
const cacheDir = path.join(app.getPath('userData'), 'tesseract')
if (!fs.existsSync(cacheDir)) {
// use access to check if the directory exists
if (
!(await fs.promises
.access(cacheDir, fs.constants.F_OK)
.then(() => true)
.catch(() => false))
) {
await fs.promises.mkdir(cacheDir, { recursive: true })
}
return cacheDir