From 51fc55b72374b46d5fdf165d5ed1ac3b6bf9f1d6 Mon Sep 17 00:00:00 2001 From: Jason Dent Date: Fri, 8 Apr 2022 13:14:12 +0200 Subject: [PATCH] fix: relative path name (#2675) Fix relative path names when reading the file list from `stdin`. --- packages/cspell/src/util/async.ts | 6 +++++- packages/cspell/src/util/fileHelper.ts | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/cspell/src/util/async.ts b/packages/cspell/src/util/async.ts index 4c77904b8e3..dd648919818 100644 --- a/packages/cspell/src/util/async.ts +++ b/packages/cspell/src/util/async.ts @@ -1 +1,5 @@ -export { toAsyncIterable as mergeAsyncIterables, toArray as asyncIterableToArray } from '@cspell/cspell-pipe'; +export { + toAsyncIterable as mergeAsyncIterables, + toArray as asyncIterableToArray, + opMap as asyncMap, +} from '@cspell/cspell-pipe'; diff --git a/packages/cspell/src/util/fileHelper.ts b/packages/cspell/src/util/fileHelper.ts index 07ca72a7387..0bd41131a5f 100644 --- a/packages/cspell/src/util/fileHelper.ts +++ b/packages/cspell/src/util/fileHelper.ts @@ -5,7 +5,7 @@ import { GlobOptions, globP } from './glob'; import * as path from 'path'; import { CSpellUserSettings, Document, fileToDocument, Issue } from 'cspell-lib'; import { IOError, toApplicationError, toError } from './errors'; -import { mergeAsyncIterables } from './async'; +import { mergeAsyncIterables, asyncMap } from './async'; import { readStdin } from './stdin'; const UTF8: BufferEncoding = 'utf8'; @@ -135,6 +135,12 @@ export function calcFinalConfigInfo( }; } +function resolveFilename(filename: string): string { + return path.resolve(filename); +} + +const resolveFilenames = asyncMap(resolveFilename); + /** * Read * @param listFiles - array of file paths to read that will contain a list of files. Paths contained in each @@ -150,7 +156,7 @@ export async function readFileListFiles(listFiles: string[]): Promise