Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Security Notes",
"description": "Create notes during a security code review. Import your favorite SAST tool results and collaborate with others.",
"icon": "resources/security_notes_logo.png",
"version": "1.0.0",
"version": "1.0.1",
"publisher": "refactor-security",
"private": false,
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion src/persistence/local-db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { Serializer } from '../serialization/serializer';
import { Deserializer } from '../serialization/deserializer';
import { CommentThread } from 'vscode';
import { getSetting } from '../../helpers';
import { getLocalDbFilePath } from '../../utils';

const persistenceFile = getSetting('localDatabase');
const persistenceFile = getLocalDbFilePath();

export const saveCommentsToFile = (noteList: Map<string, CommentThread>) => {
fs.writeFileSync(persistenceFile, JSON.stringify(Serializer.serialize(noteList)));
Expand Down
2 changes: 1 addition & 1 deletion src/persistence/serialization/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class Serializer {
thread.comments.forEach((comment) => {
serializedComments.push(this.serializeComment(comment));
});
let uri = fullPathToRelative(thread.uri.path);
let uri = fullPathToRelative(thread.uri.fsPath);
if (isWindows()) {
uri = pathToPosix(uri);
}
Expand Down
12 changes: 11 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import * as vscode from 'vscode';
import * as path from 'path';
import { platform } from 'os';
import { getSetting } from '../helpers';

export const isWindows = () => {
return platform() === 'win32';
Expand All @@ -18,12 +19,21 @@ export const pathToWin32 = (aPath: string) => {

export const getWorkspacePath = () => {
if (vscode.workspace.workspaceFolders) {
return vscode.workspace.workspaceFolders[0].uri.path;
return vscode.workspace.workspaceFolders[0].uri.fsPath;
} else {
return '';
}
};

export const getLocalDbFilePath = () => {
const localDbFilePath = getSetting('localDatabase');
if (path.isAbsolute(localDbFilePath)) {
return localDbFilePath;
} else {
return relativePathToFull(localDbFilePath);
}
};

export const relativePathToFull = (aPath: string, basePath?: string) => {
if (basePath) {
return path.join(basePath, aPath);
Expand Down