Skip to content

Commit 55f32e3

Browse files
committed
Windows Permission problems
1 parent 41ce39f commit 55f32e3

File tree

3 files changed

+38
-20
lines changed

3 files changed

+38
-20
lines changed

src/frontend/extension.ts

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -410,27 +410,33 @@ export class CortexDebugExtension {
410410
private debugSessionTerminated(session: vscode.DebugSession) {
411411
if (session.type !== 'cortex-debug') { return; }
412412

413-
Reporting.endSession();
413+
try {
414+
Reporting.endSession();
414415

415-
this.registerProvider.debugSessionTerminated();
416-
this.peripheralProvider.debugSessionTerminated();
417-
if (this.swo) {
418-
this.swo.debugSessionTerminated();
419-
}
420-
if (this.rtt) {
421-
this.rtt.debugSessionTerminated();
422-
}
423-
if (this.swoSource) {
424-
this.swoSource.dispose();
425-
this.swoSource = null;
426-
}
416+
this.registerProvider.debugSessionTerminated();
417+
this.peripheralProvider.debugSessionTerminated();
418+
if (this.swo) {
419+
this.swo.debugSessionTerminated();
420+
}
421+
if (this.rtt) {
422+
this.rtt.debugSessionTerminated();
423+
}
424+
if (this.swoSource) {
425+
this.swoSource.dispose();
426+
this.swoSource = null;
427+
}
427428

428-
this.rttSources.forEach((s) => s.dispose())
429-
this.rttSources = [];
430-
this.rttTerminals.forEach((t) => t.inUse = false);
431-
this.rttPortMap = {};
429+
this.rttSources.forEach((s) => s.dispose())
430+
this.rttSources = [];
431+
this.rttTerminals.forEach((t) => t.inUse = false);
432+
this.rttPortMap = {};
432433

433-
this.clearAdapterOutputChannel = true;
434+
this.clearAdapterOutputChannel = true;
435+
}
436+
catch (e) {
437+
vscode.window.showInformationMessage('Debug session did not terminate cleanly ${e}. Please report this problem');
438+
}
439+
434440
}
435441

436442
private receivedCustomEvent(e: vscode.DebugSessionCustomEvent) {

src/frontend/views/peripheral.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ export class PeripheralTreeProvider implements vscode.TreeDataProvider<Periphera
2929
state.push(... p.saveState());
3030
});
3131

32-
fs.writeFileSync(path, JSON.stringify(state), { encoding: 'utf8', flag: 'w' });
32+
try {
33+
fs.writeFileSync(path, JSON.stringify(state), { encoding: 'utf8', flag: 'w' });
34+
}
35+
catch (e) {
36+
vscode.window.showWarningMessage(`Unable to save periperal preferences ${e}`);
37+
}
3338
}
3439

3540
private loadSVD(SVDFile: string): Thenable<any> {

src/frontend/views/registers.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { TreeItem, TreeDataProvider, EventEmitter, Event, TreeItemCollapsibleState, debug, workspace, ProviderResult} from 'vscode';
22
import * as fs from 'fs';
33
import * as path from 'path';
4+
import * as vscode from 'vscode';
45

56
import { NodeSetting } from '../../common';
67
import { RegisterNode, RegisterValue } from './nodes/registernode';
78
import { MessageNode } from './nodes/messagenode';
89
import { BaseNode } from './nodes/basenode';
10+
import { getVSCodeDownloadUrl } from 'vscode-test/out/util';
911

1012
export class RegisterTreeProvider implements TreeDataProvider<BaseNode> {
1113
// tslint:disable-next-line:variable-name
@@ -121,7 +123,12 @@ export class RegisterTreeProvider implements TreeDataProvider<BaseNode> {
121123
state.push(...r._saveState());
122124
});
123125

124-
fs.writeFileSync(fspath, JSON.stringify(state), { encoding: 'utf8', flag: 'w' });
126+
try {
127+
fs.writeFileSync(fspath, JSON.stringify(state), { encoding: 'utf8', flag: 'w' });
128+
}
129+
catch (e) {
130+
vscode.window.showWarningMessage(`Unable to save register preferences ${e}`);
131+
}
125132
}
126133

127134
public debugSessionTerminated() {

0 commit comments

Comments
 (0)