mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-06 08:52:47 +02:00
#398: Fix Windows folder path parsing in data folder retrieval
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
- [#384](https://github.com/estruyf/vscode-front-matter/issues/384): Fix issue `title` field in sub-fields
|
||||
- [#393](https://github.com/estruyf/vscode-front-matter/issues/393): Fix Windows file path for retrieving the preview path
|
||||
- [#396](https://github.com/estruyf/vscode-front-matter/issues/396): Fix for `index` and `_index` page previews
|
||||
- [#398](https://github.com/estruyf/vscode-front-matter/issues/398): Fix Windows folder path parsing in data folder retrieval
|
||||
|
||||
## [8.0.1] - 2022-07-13
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ export class Folders {
|
||||
const isWindows = process.platform === 'win32';
|
||||
let absPath = filePath.replace(WORKSPACE_PLACEHOLDER, parseWinPath(wsFolder?.fsPath || ""));
|
||||
absPath = isWindows ? absPath.split('/').join('\\') : absPath;
|
||||
return absPath;
|
||||
return parseWinPath(absPath);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,7 +381,7 @@ export class Folders {
|
||||
const isWindows = process.platform === 'win32';
|
||||
let absPath = folder.path.replace(WORKSPACE_PLACEHOLDER, parseWinPath(wsFolder?.fsPath || ""));
|
||||
absPath = isWindows ? absPath.split('/').join('\\') : absPath;
|
||||
return absPath;
|
||||
return parseWinPath(absPath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ import { DataType } from "../models/DataType";
|
||||
import { Extension } from "./Extension";
|
||||
import { FrameworkDetector } from "./FrameworkDetector";
|
||||
import { Settings } from "./SettingsHelper";
|
||||
import { parseWinPath } from './parseWinPath';
|
||||
|
||||
|
||||
export class DashboardSettings {
|
||||
@@ -76,7 +77,7 @@ export class DashboardSettings {
|
||||
* @returns
|
||||
*/
|
||||
private static async getDataFiles(): Promise<DataFile[]> {
|
||||
const wsPath = Folders.getWorkspaceFolder()?.fsPath;
|
||||
const wsPath = parseWinPath(Folders.getWorkspaceFolder()?.fsPath);
|
||||
const files = Settings.get<DataFile[]>(SETTING_DATA_FILES);
|
||||
const folders = Settings.get<DataFolder[]>(SETTING_DATA_FOLDERS);
|
||||
|
||||
@@ -92,14 +93,14 @@ export class DashboardSettings {
|
||||
continue;
|
||||
}
|
||||
|
||||
let dataFolderPath = join(folderPath.replace((wsPath || ''), ''));
|
||||
let dataFolderPath = parseWinPath(join(folderPath.replace((wsPath || ''), '')));
|
||||
if (dataFolderPath.startsWith('/')) {
|
||||
dataFolderPath = dataFolderPath.substring(1);
|
||||
}
|
||||
|
||||
const dataJsonFiles = await workspace.findFiles(join(dataFolderPath, '*.json'));
|
||||
const dataYmlFiles = await workspace.findFiles(join(dataFolderPath, '*.yml'));
|
||||
const dataYamlFiles = await workspace.findFiles(join(dataFolderPath, '*.yaml'));
|
||||
const dataJsonFiles = await workspace.findFiles(parseWinPath(join(dataFolderPath, '*.json')));
|
||||
const dataYmlFiles = await workspace.findFiles(parseWinPath(join(dataFolderPath, '*.yml')));
|
||||
const dataYamlFiles = await workspace.findFiles(parseWinPath(join(dataFolderPath, '*.yaml')));
|
||||
|
||||
const dataFiles = [...dataJsonFiles, ...dataYmlFiles, ...dataYamlFiles];
|
||||
for (let dataFile of dataFiles) {
|
||||
|
||||
Reference in New Issue
Block a user