From 6cfdd4fb906a4afc3573d2ce933cf08f8d80a1d9 Mon Sep 17 00:00:00 2001 From: Evan Date: Thu, 6 Feb 2025 18:28:42 -0800 Subject: [PATCH] duplicate path function --- src/services/glob/list-files.ts | 2 +- src/services/ripgrep/index.ts | 4 ++-- src/utils/path.ts | 8 -------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/services/glob/list-files.ts b/src/services/glob/list-files.ts index 3e13409557..745ac60d4d 100644 --- a/src/services/glob/list-files.ts +++ b/src/services/glob/list-files.ts @@ -1,7 +1,7 @@ import { globby, Options } from "globby" import os from "os" import * as path from "path" -import { arePathsEqual, pathExists } from "../../utils/path" +import { arePathsEqual } from "../../utils/path" export async function listFiles(dirPath: string, recursive: boolean, limit: number): Promise<[string[], boolean]> { const absolutePath = path.resolve(dirPath) diff --git a/src/services/ripgrep/index.ts b/src/services/ripgrep/index.ts index ea3652b947..d6c0c72fe4 100644 --- a/src/services/ripgrep/index.ts +++ b/src/services/ripgrep/index.ts @@ -2,8 +2,8 @@ import * as vscode from "vscode" import * as childProcess from "child_process" import * as path from "path" import * as readline from "readline" -import { pathExists } from "../../utils/path" import { LLMFileAccessController } from "../llm-access-control/LLMFileAccessController" +import { fileExistsAtPath } from "../../utils/fs" /* This file provides functionality to perform regex searches on files using ripgrep. @@ -64,7 +64,7 @@ const MAX_RESULTS = 300 async function getBinPath(vscodeAppRoot: string): Promise { const checkPath = async (pkgFolder: string) => { const fullPath = path.join(vscodeAppRoot, pkgFolder, binName) - return (await pathExists(fullPath)) ? fullPath : undefined + return (await fileExistsAtPath(fullPath)) ? fullPath : undefined } return ( diff --git a/src/utils/path.ts b/src/utils/path.ts index b9507be740..90cff1c719 100644 --- a/src/utils/path.ts +++ b/src/utils/path.ts @@ -100,11 +100,3 @@ export function getReadablePath(cwd: string, relPath?: string): string { } } } - -export async function pathExists(path: string): Promise { - return new Promise((resolve) => { - fs.access(path, (err) => { - resolve(err === null) - }) - }) -}