mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2026-03-23 09:39:29 -04:00
Refactor out file helpers into fs.ts
This commit is contained in:
@@ -8,6 +8,7 @@ import TurndownService from "turndown"
|
||||
import PCR from "puppeteer-chromium-resolver"
|
||||
import pWaitFor from "p-wait-for"
|
||||
import delay from "delay"
|
||||
import { fileExistsAtPath } from "../../utils/fs"
|
||||
|
||||
interface PCRStats {
|
||||
puppeteer: { launch: typeof launch }
|
||||
@@ -30,10 +31,7 @@ export class UrlContentFetcher {
|
||||
}
|
||||
|
||||
const puppeteerDir = path.join(globalStoragePath, "puppeteer")
|
||||
const dirExists = await fs
|
||||
.access(puppeteerDir)
|
||||
.then(() => true)
|
||||
.catch(() => false)
|
||||
const dirExists = await fileExistsAtPath(puppeteerDir)
|
||||
if (!dirExists) {
|
||||
await fs.mkdir(puppeteerDir, { recursive: true })
|
||||
}
|
||||
|
||||
@@ -2,14 +2,12 @@ import * as fs from "fs/promises"
|
||||
import * as path from "path"
|
||||
import { listFiles } from "../glob/list-files"
|
||||
import { LanguageParser, loadRequiredLanguageParsers } from "./languageParser"
|
||||
import { fileExistsAtPath } from "../../utils/fs"
|
||||
|
||||
// TODO: implement caching behavior to avoid having to keep analyzing project for new tasks.
|
||||
export async function parseSourceCodeForDefinitionsTopLevel(dirPath: string): Promise<string> {
|
||||
// check if the path exists
|
||||
const dirExists = await fs
|
||||
.access(path.resolve(dirPath))
|
||||
.then(() => true)
|
||||
.catch(() => false)
|
||||
const dirExists = await fileExistsAtPath(path.resolve(dirPath))
|
||||
if (!dirExists) {
|
||||
return "This directory does not exist or you do not have permission to access it."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user