voidconnect 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.js +6 -1
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -38,6 +38,7 @@ async function install() {
|
|
|
38
38
|
|
|
39
39
|
const destPath = path.join(binDir, binary);
|
|
40
40
|
if (fs.existsSync(destPath)) {
|
|
41
|
+
addToPath(binDir);
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -106,6 +107,10 @@ function extract(file, dest, extension, binary) {
|
|
|
106
107
|
throw error;
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
addToPath(dest);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function addToPath(dest) {
|
|
109
114
|
// Add to PATH on Windows if not present
|
|
110
115
|
if (os.platform() === 'win32') {
|
|
111
116
|
try {
|
|
@@ -113,7 +118,7 @@ function extract(file, dest, extension, binary) {
|
|
|
113
118
|
if (!userPath.includes(dest)) {
|
|
114
119
|
const newPath = `${userPath};${dest}`;
|
|
115
120
|
// Powershell command to set the new path
|
|
116
|
-
const setPathCmd = `[Environment]::SetEnvironmentVariable(
|
|
121
|
+
const setPathCmd = `[Environment]::SetEnvironmentVariable('Path', '${newPath.replace(/'/g, "''")}', [EnvironmentVariableTarget]::User)`;
|
|
117
122
|
execSync(`powershell -Command "${setPathCmd}"`);
|
|
118
123
|
console.log(`Added ${dest} to user PATH.`);
|
|
119
124
|
console.log('You may need to restart your terminal for changes to take effect.');
|