mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-06 17:02:54 +02:00
#44 - Windows path fix
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user