Skip to content

Commit

Permalink
lnote-1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhwagk committed Feb 16, 2024
1 parent e8118e0 commit 6b85050
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 8 additions & 7 deletions src/database/note.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path';

import {
existsSync, mkdirpSync, removeSync
existsSync, mkdirpSync, readdirSync, removeSync
} from 'fs-extra';

import { vfs } from '../helper';
Expand All @@ -11,9 +11,10 @@ import { nbGroup } from '../constants';

export class LNote {
filesPath: string;
docPath: string;
docMainFile: string;

mainFile: string = "main.md";

als: ArrayLabels;

constructor(
Expand All @@ -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;
Expand Down Expand Up @@ -56,7 +57,7 @@ export class LNote {
}

public removeDoc() {
removeSync(this.docPath);
// removeSync(this.docPath);
}

public removeFiles() {
Expand All @@ -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, '');
}

Expand Down

0 comments on commit 6b85050

Please sign in to comment.