#44 - Windows path fix

This commit is contained in:
Elio
2021-08-04 15:00:26 +02:00
parent b8dc7990f7
commit df84c25e01
3 changed files with 9 additions and 20 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# Change Log
## [2.1.0] - 2020-08-XX - Upcoming release
## [2.1.0] - 2020-08-04
- [#44](https://github.com/estruyf/vscode-front-matter/issues/45): Added article creation command
- [#45](https://github.com/estruyf/vscode-front-matter/issues/45): WSL support added
+8 -7
View File
@@ -7,6 +7,10 @@ import { Template } from "./Template";
export class Folders {
/**
* Create content in a registered folder
* @returns
*/
public static async create() {
const folders = Folders.get();
@@ -38,12 +42,12 @@ export class Folders {
* @param folder
*/
public static async register(folder: Uri) {
if (folder && folder.path) {
const wslPath = folder.path.replace(/\//g, '\\');
if (folder && folder.fsPath) {
const wslPath = folder.fsPath.replace(/\//g, '\\');
let folders = Folders.get();
const exists = folders.find(f => f.paths.includes(folder.path) || f.paths.includes(wslPath));
const exists = folders.find(f => f.paths.includes(folder.fsPath) || f.paths.includes(wslPath));
if (exists) {
return window.showInformationMessage(`Folder is already registered`);
@@ -58,10 +62,7 @@ export class Folders {
folders.push({
title: folderName,
fsPath: folder.fsPath,
paths: [
folder.path,
wslPath
]
paths: folder.fsPath === wslPath ? [folder.fsPath] : [folder.fsPath, wslPath]
} as ContentFolder);
folders = uniqBy(folders, f => f.fsPath);
-12
View File
@@ -80,18 +80,6 @@ export async function activate({ subscriptions, extensionUri }: vscode.Extension
const createContent = vscode.commands.registerCommand(`frontMatter.createContent`, Folders.create);
try {
const allPaths = await vscode.commands.executeCommand("_workbench.getRecentlyOpened");
console.log(vscode.window.activeTextEditor?.document.uri)
console.log(vscode.Uri.parse(`vscode-remote:///home`))
console.log(`remoteName`, vscode.env.remoteName);
console.log(`appRoot`, vscode.env.appRoot);
} catch (e) {
console.log(e?.message || e)
}
Folders.updateVsCodeCtx();
// Create the status bar