Commit eb3e1b7c authored by Timon Stampfli's avatar Timon Stampfli

feature workspaceconfig is adjusted to platform

parent 7cfec2d5
......@@ -52,6 +52,7 @@ async function determineWorkspaceFolder(): Promise<string | null> {
}
async function determineWorkspaceSettingsFileContent(
store: Store,
workspace: string
): Promise<string | null> {
let workspaceSettings = await vscode.workspace.findFiles("soiworkspace.json");
......@@ -73,7 +74,7 @@ async function determineWorkspaceSettingsFileContent(
try {
await fs.writeFile(
path.join(workspace, "soiworkspace.json"),
soiWorkspaceTemplate_0_8_0()
soiWorkspaceTemplate_0_8_0(store)
);
} catch (err) {
vscode.window.showErrorMessage(
......@@ -98,9 +99,11 @@ async function determineWorkspaceSettingsFileContent(
}
async function determineWorkspaceSettings(
store: Store,
workspace: string
): Promise<WorkspaceSettings | null> {
let workspaceSettingsFileContent = await determineWorkspaceSettingsFileContent(
store,
workspace
);
if (workspaceSettingsFileContent === null) {
......@@ -118,12 +121,14 @@ async function determineWorkspaceSettings(
}
}
export async function readWorkspaceState(): Promise<WorkspaceState> {
export async function readWorkspaceState(
store: Store
): Promise<WorkspaceState> {
let workdir = await determineWorkspaceFolder();
if (workdir === null) {
return "NoFolderOpen";
}
let settings = await determineWorkspaceSettings(workdir);
let settings = await determineWorkspaceSettings(store, workdir);
if (settings === null) {
return "NoSOIWorkspace";
}
......@@ -139,6 +144,6 @@ export async function readWorkspaceState(): Promise<WorkspaceState> {
export async function initializeWorkspace(store: Store) {
let workspace = await determineWorkspaceFolder();
if (workspace !== null) {
await determineWorkspaceSettings(workspace);
await determineWorkspaceSettings(store, workspace);
}
}
export function soiWorkspaceTemplate_0_8_0(): string {
import { determinePlatform } from "../util";
import { Store } from "../store";
import * as path from "path";
export function soiWorkspaceTemplate_0_8_0(store: Store): string {
if (determinePlatform() === "windows-amd64") {
return `{
"workspace":{
"templateVersion":"0.8.0"
},
"settings": {
"compilerPath": "${path.join(
store.soicodeExtensionDataPath,
"bundle",
"soiheaders",
"compiler",
"bin"
)}",
"debuggerPath": "no/gdb",
"cppHeaderPath": "${path.join(
store.soicodeExtensionDataPath,
"bundle",
"soiheaders",
"soiheader"
)}",
"soiHeaderPath": "",
"flags": "-Wall -Wextra -std=c++17 -g3 -ggdb3 -D_GLIBCXX_DEBUG",
"useBundledSoiHeaders": true
}
}
`;
}
if (determinePlatform() === "darwin-amd64") {
return `{
"workspace":{
"templateVersion":"0.8.0"
},
"settings": {
"compilerPath": "/usr/bin/c++",
"debuggerPath": "/usr/bin/gdb",
"cppHeaderPath": "",
"soiHeaderPath": "",
"flags": "-Wall -Wextra -std=c++17 -g3 -ggdb3 -D_GLIBCXX_DEBUG",
"useBundledSoiHeaders": true
}
}
`;
}
return `{
"workspace":{
"templateVersion":"0.8.0"
......
......@@ -55,7 +55,7 @@ export class Store {
}
emitFsChange(this: Store) {
readWorkspaceState().then(workspaceState => {
readWorkspaceState(this).then(workspaceState => {
this.workspace = workspaceState;
for (let sub of this.fileChangeSubscribers) {
sub();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment