ropilot 0.1.3 → 0.1.4
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/lib/setup.js +50 -4
- package/package.json +1 -1
package/lib/setup.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Installing Studio plugin
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { existsSync, writeFileSync, mkdirSync, readFileSync } from 'fs';
|
|
11
|
+
import { existsSync, writeFileSync, mkdirSync, readFileSync, readdirSync } from 'fs';
|
|
12
12
|
import { join, dirname } from 'path';
|
|
13
13
|
import { homedir, platform } from 'os';
|
|
14
14
|
import { createInterface } from 'readline';
|
|
@@ -28,17 +28,57 @@ const PLUGIN_VERSION_URL = 'https://ropilot.ai/plugin/version';
|
|
|
28
28
|
const PLUGIN_DOWNLOAD_URL = 'https://ropilot.ai/plugin/StudioPlugin.lua';
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Check if running in WSL
|
|
32
|
+
*/
|
|
33
|
+
function isWSL() {
|
|
34
|
+
try {
|
|
35
|
+
const release = readFileSync('/proc/version', 'utf-8').toLowerCase();
|
|
36
|
+
return release.includes('microsoft') || release.includes('wsl');
|
|
37
|
+
} catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get Windows username when running in WSL
|
|
44
|
+
*/
|
|
45
|
+
function getWindowsUsername() {
|
|
46
|
+
try {
|
|
47
|
+
const { execSync } = require('child_process');
|
|
48
|
+
const username = execSync('cmd.exe /c echo %USERNAME%', { encoding: 'utf-8' }).trim();
|
|
49
|
+
if (username && !username.includes('%')) {
|
|
50
|
+
return username;
|
|
51
|
+
}
|
|
52
|
+
} catch {}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get Roblox plugins folder path based on OS (with WSL detection)
|
|
32
58
|
*/
|
|
33
59
|
function getPluginsFolder() {
|
|
34
60
|
const os = platform();
|
|
61
|
+
|
|
62
|
+
// Check for WSL first - need to use Windows path
|
|
63
|
+
if (os === 'linux' && isWSL()) {
|
|
64
|
+
const windowsUser = getWindowsUsername();
|
|
65
|
+
if (windowsUser) {
|
|
66
|
+
const pluginsPath = join('/mnt/c/Users', windowsUser, 'AppData', 'Local', 'Roblox', 'Plugins');
|
|
67
|
+
if (existsSync(dirname(pluginsPath)) || existsSync('/mnt/c/Users/' + windowsUser)) {
|
|
68
|
+
return pluginsPath;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
console.log(' Warning: Could not detect Windows username for WSL plugin install');
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
35
75
|
if (os === 'win32') {
|
|
36
76
|
return join(process.env.LOCALAPPDATA || join(homedir(), 'AppData', 'Local'), 'Roblox', 'Plugins');
|
|
37
77
|
} else if (os === 'darwin') {
|
|
38
78
|
return join(homedir(), 'Documents', 'Roblox', 'Plugins');
|
|
39
79
|
} else {
|
|
40
|
-
// Linux - Roblox doesn't officially support Linux
|
|
41
|
-
return
|
|
80
|
+
// Linux without WSL - Roblox doesn't officially support Linux
|
|
81
|
+
return null;
|
|
42
82
|
}
|
|
43
83
|
}
|
|
44
84
|
|
|
@@ -84,6 +124,12 @@ async function installPlugin() {
|
|
|
84
124
|
// Get plugins folder
|
|
85
125
|
const pluginsFolder = getPluginsFolder();
|
|
86
126
|
|
|
127
|
+
if (!pluginsFolder) {
|
|
128
|
+
console.log(' Could not determine Roblox plugins folder');
|
|
129
|
+
console.log(' Manual install: Download from https://ropilot.ai/plugin/StudioPlugin.lua');
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
87
133
|
// Create plugins folder if it doesn't exist
|
|
88
134
|
mkdirSync(pluginsFolder, { recursive: true });
|
|
89
135
|
|