From 6b85050eb021c6e1bae25f2d891be924a50c4f36 Mon Sep 17 00:00:00 2001 From: gk Date: Fri, 16 Feb 2024 10:37:41 +0800 Subject: [PATCH] lnote-1.1.0 --- package.json | 2 +- src/database/note.ts | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index c25c7045..bbebd042 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "lnote", "displayName": "lnote", "description": "A simple note-taking extension.", - "version": "1.0.8", + "version": "1.1.0", "icon": "icon.png", "publisher": "shinhwagk", "preview": true, diff --git a/src/database/note.ts b/src/database/note.ts index 5f1cb695..12c07162 100644 --- a/src/database/note.ts +++ b/src/database/note.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import { - existsSync, mkdirpSync, removeSync + existsSync, mkdirpSync, readdirSync, removeSync } from 'fs-extra'; import { vfs } from '../helper'; @@ -11,9 +11,10 @@ import { nbGroup } from '../constants'; export class LNote { filesPath: string; - docPath: string; docMainFile: string; + mainFile: string = "main.md"; + als: ArrayLabels; constructor( @@ -26,8 +27,8 @@ export class LNote { public gls: GroupLables, ) { this.filesPath = path.join(this.dir, "files", this.id); - this.docPath = path.join(this.dir, "doc", this.id); - this.docMainFile = path.join(this.docPath, 'main.md'); + // this.docPath = path.join(this.dir, "doc", this.id); + this.docMainFile = path.join(this.filesPath, this.mainFile); this.contents = contents; this.cts = cts; @@ -56,7 +57,7 @@ export class LNote { } public removeDoc() { - removeSync(this.docPath); + // removeSync(this.docPath); } public removeFiles() { @@ -68,11 +69,11 @@ export class LNote { } public checkFilesExist() { - return existsSync(this.filesPath); + return existsSync(this.filesPath) || readdirSync(this.filesPath).filter(f => f !== this.mainFile).length >= 1; } public createDoc() { - mkdirpSync(this.docPath); + mkdirpSync(this.filesPath); vfs.writeFileSync(this.docMainFile, ''); }