Skip to content

Commit 1e6b52d

Browse files
committed
fix: Save both relative and absolute paths
- Resolve path of idfTarget is saved in ESP.ProjectConfiguration.store - Original paths from "esp_idf_project_configuration.json" remain unchanged
1 parent 4d07b76 commit 1e6b52d

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/project-conf/index.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ export async function updateCurrentProfileIdfTarget(
6060
return;
6161
}
6262

63-
const projectConfJson = await getProjectConfigurationElements(
63+
const resolvedProjectConfJson = await getProjectConfigurationElements(
6464
workspaceFolder,
6565
true
6666
);
6767

68-
if (!projectConfJson[selectedConfig]) {
68+
if (!resolvedProjectConfJson[selectedConfig]) {
6969
const err = new Error(
7070
`Configuration "${selectedConfig}" not found in ${ESP.ProjectConfiguration.PROJECT_CONFIGURATION_FILENAME}.`
7171
);
@@ -76,13 +76,23 @@ export async function updateCurrentProfileIdfTarget(
7676
);
7777
return;
7878
}
79-
projectConfJson[selectedConfig].idfTarget = idfTarget;
8079

80+
resolvedProjectConfJson[selectedConfig].idfTarget = idfTarget;
8181
ESP.ProjectConfiguration.store.set(
8282
selectedConfig,
83-
projectConfJson[selectedConfig]
83+
resolvedProjectConfJson[selectedConfig]
8484
);
85-
await saveProjectConfFile(workspaceFolder, projectConfJson);
85+
86+
const originalProjectConfJson = await getProjectConfigurationElements(
87+
workspaceFolder,
88+
false
89+
);
90+
91+
if (originalProjectConfJson[selectedConfig]) {
92+
originalProjectConfJson[selectedConfig].idfTarget = idfTarget;
93+
}
94+
95+
await saveProjectConfFile(workspaceFolder, originalProjectConfJson);
8696
}
8797

8898
export async function saveProjectConfFile(
@@ -207,7 +217,10 @@ function substituteVariablesInString(
207217
configVarName = configVar.substring(0, delimiterIndex);
208218
prefix = configVar.substring(delimiterIndex + 1).trim();
209219
}
210-
const configVarValue = parameterToSameProjectConfigMap(configVarName, config);
220+
const configVarValue = parameterToSameProjectConfigMap(
221+
configVarName,
222+
config
223+
);
211224

212225
if (!configVarValue) {
213226
return match;

0 commit comments

Comments
 (0)