Skip to content

Commit

Permalink
Issue #896. Proper handling of OS overrides for settings
Browse files Browse the repository at this point in the history
  • Loading branch information
haneefdm committed Jun 6, 2023
1 parent a86cfb2 commit f865b63
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Issue #861: Potential fix
* Issue #867: STLink make it so that user has to enable `-shared` if needed. Before it was automatically added to the command-line and there was no (good) way to remove it
* Issue #882: Potential fix. In some cases the extension would crash while single stepping
* Issue #896: Bug in handling of OS specific overrides (like `cortex-debug.gdbPath.linux`)

# V1.11.2
* Minor bug fix to guard against invalid expressions (watch and live watch)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.11.3-pre4",
"version": "1.11.3-pre5",
"preview": false,
"activationEvents": [
"onDebugResolve:cortex-debug",
Expand Down
16 changes: 12 additions & 4 deletions src/frontend/configprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,18 @@ export class CortexDebugConfigurationProvider implements vscode.DebugConfigurati

private setOsSpecficConfigSetting(config: vscode.DebugConfiguration, dstName: string, propName: string = '') {
if (!config[dstName]) {
const configuration = vscode.workspace.getConfiguration('cortex-debug');
const osName = os.platform();
const osOverride = (propName || dstName) + '.' + ((osName === 'win32') ? 'windows' : (osName === 'darwin') ? 'osx' : 'linux');
config[dstName] = configuration.get(osOverride, configuration.get(propName || dstName, ''));
propName = propName || dstName;
const settings = vscode.workspace.getConfiguration('cortex-debug');
const obj = settings[propName];
if (obj) {
if (typeof obj === 'object') {
const osName = os.platform();
const osOverride = ((osName === 'win32') ? 'windows' : (osName === 'darwin') ? 'osx' : 'linux');
config[dstName] = obj[osOverride] || '';
} else {
config[dstName] = obj;
}
}
}
}

Expand Down

0 comments on commit f865b63

Please sign in to comment.