ia_rewrite_ntapp 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/setup.js +13 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ia_rewrite_ntapp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "CLI para reescrever texto selecionado via IA",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/setup.js CHANGED
@@ -5,23 +5,29 @@ const { execSync } = require("child_process");
5
5
  const { ensureConfig, CONFIG_FILE } = require("./configure");
6
6
 
7
7
  function createShortcut() {
8
- const desktop = path.join(process.env.USERPROFILE || os.homedir(), "Desktop");
8
+ const startMenuPrograms = path.join(
9
+ process.env.APPDATA || path.join(process.env.USERPROFILE || os.homedir(), "AppData", "Roaming"),
10
+ "Microsoft",
11
+ "Windows",
12
+ "Start Menu",
13
+ "Programs"
14
+ );
9
15
  const target = process.execPath;
10
16
  const script = path.join(__dirname, "index.js");
11
- const lnkPath = path.join(desktop, "ia_rewrite_ntapp.lnk");
17
+ const lnkPath = path.join(startMenuPrograms, "ia_rewrite_ntapp.lnk");
12
18
 
13
19
  const ps = [
14
20
  "$WshShell = New-Object -ComObject WScript.Shell",
15
- `$Shortcut = $WshShell.CreateShortcut(\"${lnkPath}\")`,
16
- `$Shortcut.TargetPath = \"${target}\"`,
17
- `$Shortcut.Arguments = \"${script}\"`,
18
- `$Shortcut.WorkingDirectory = \"${__dirname}\"`,
21
+ `$Shortcut = $WshShell.CreateShortcut(\\"${lnkPath}\\")`,
22
+ `$Shortcut.TargetPath = \\\"${target}\\\"`,
23
+ `$Shortcut.Arguments = \\\"${script}\\\"`,
24
+ `$Shortcut.WorkingDirectory = \\\"${__dirname}\\\"`,
19
25
  "$Shortcut.WindowStyle = 7",
20
26
  "$Shortcut.Hotkey = 'Ctrl+Alt+R'",
21
27
  "$Shortcut.Save()",
22
28
  ].join("; ");
23
29
 
24
- execSync(`powershell -NoProfile -Command "${ps}"`, { encoding: "utf8" });
30
+ execSync(`powershell -NoProfile -Command \"${ps}\"`, { encoding: "utf8" });
25
31
  }
26
32
 
27
33
  function postInstall() {