Skip to content

Commit c89ff41

Browse files
authored
Append msys path to the tail of sys PATH, not head
1 parent 3cd79b7 commit c89ff41

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

src/extension.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -761,13 +761,14 @@ function exportEnvToSysPath(context?: vscode.ExtensionContext) {
761761
const legacyBuilderDir = resManager.getLegacyBuilderDir();
762762

763763
// export some eide binaries path to system env path
764-
const systemEnvPaths: string[] = [
764+
const prependSystemPaths: string[] = [
765765
File.normalize(`${resManager.getUnifyBuilderExe().dir}`),
766-
File.normalize(`${legacyBuilderDir.path}/utils`), // utils tool folder
767-
File.normalize(`${legacyBuilderDir.dir}/scripts`),
768-
File.normalize(`${resManager.Get7zDir().path}`), // export built-in 7za tool
769-
File.normalize(`${resManager.getBuiltInToolsDir().path}/utils`) // builtin utils tool folder
766+
File.normalize(`${legacyBuilderDir.path}/utils`), // C:\Users\<USER-NAME>\.eide\bin\builder\utils
767+
File.normalize(`${legacyBuilderDir.dir}/scripts`), // C:\Users\<USER-NAME>\.eide\bin\scripts
768+
File.normalize(`${resManager.Get7zDir().path}`), // builtin 7za tool
769+
File.normalize(`${resManager.getBuiltInToolsDir().path}/utils`) // builtin util tools
770770
];
771+
const appendSystemPaths: string[] = [];
771772

772773
//
773774
const eideToolsFolder = new File(File.normalize(`${platform.userhome()}/.eide/tools`));
@@ -852,20 +853,28 @@ function exportEnvToSysPath(context?: vscode.ExtensionContext) {
852853
}
853854
});
854855

855-
// append all tools to system env paths
856+
// prepend/append all tools to system env paths
856857
pathList
857858
.filter((env) => File.IsDir(env.path))
858859
.forEach(envInfo => {
859-
systemEnvPaths.push(envInfo.path);
860-
if (envInfo.extraPath) {
861-
envInfo.extraPath.forEach(p => systemEnvPaths.push(p));
860+
if (['EIDE_MSYS'].includes(envInfo.key)) {
861+
appendSystemPaths.push(envInfo.path);
862+
if (envInfo.extraPath) {
863+
envInfo.extraPath.forEach(p => appendSystemPaths.push(p));
864+
}
865+
} else {
866+
prependSystemPaths.push(envInfo.path);
867+
if (envInfo.extraPath) {
868+
envInfo.extraPath.forEach(p => prependSystemPaths.push(p));
869+
}
862870
}
863871
});
864872

865873
/* append to System Path if we not */
866874
if (isEnvSetuped == false) {
867875
isEnvSetuped = true;
868-
platform.prependToSysEnv(process.env, systemEnvPaths);
876+
platform.prependToSysEnv(process.env, prependSystemPaths);
877+
platform.appendToSysEnv(process.env, appendSystemPaths);
869878
}
870879

871880
/* update env key value */

0 commit comments

Comments
 (0)