Skip to content

Commit

Permalink
do nothing if file unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
shalldie committed Nov 14, 2024
1 parent 39ada7c commit 049bd5f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/background/PatchFile/PatchFile.javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ export class JsPatchFile extends AbsPatchFile {
public async applyPatches(patchContent: string): Promise<boolean> {
try {
await _.lock();
let content = await this.getContent();
content = this.cleanPatches(content);
const curContent = await this.getContent();
let content = this.cleanPatches(curContent);
content += [
//
`\n// vscode-background-start ${BACKGROUND_VER}.${VERSION}`,
patchContent,
'// vscode-background-end'
].join('\n');

// file unchanged
if (curContent === content) {
return true;
}

return await this.write(content);
} catch {
return false;
Expand Down

0 comments on commit 049bd5f

Please sign in to comment.