@bobfrankston/msger 0.1.15 → 0.1.16
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/index.js +12 -1
- package/index.js.map +1 -1
- package/index.ts +13 -1
- package/msger-native/build.ts +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import { platform } from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
+
import fs from 'fs';
|
|
4
5
|
/**
|
|
5
6
|
* Show a message box dialog using native Rust implementation
|
|
6
7
|
* @param options Message box configuration
|
|
@@ -8,9 +9,19 @@ import path from 'path';
|
|
|
8
9
|
*/
|
|
9
10
|
export async function showMessageBox(options) {
|
|
10
11
|
return new Promise((resolve, reject) => {
|
|
12
|
+
const isWindows = platform() === 'win32';
|
|
11
13
|
// Determine the binary name based on platform
|
|
12
|
-
const binaryName =
|
|
14
|
+
const binaryName = isWindows ? 'msgernative.exe' : 'msgernative';
|
|
13
15
|
const binaryPath = path.join(import.meta.dirname, 'msger-native', 'bin', binaryName);
|
|
16
|
+
// Ensure the binary has execute permissions on Unix systems
|
|
17
|
+
if (!isWindows && fs.existsSync(binaryPath)) {
|
|
18
|
+
try {
|
|
19
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
// Ignore permission errors if we can't set it
|
|
23
|
+
}
|
|
24
|
+
}
|
|
14
25
|
// Spawn the Rust binary
|
|
15
26
|
const child = spawn(binaryPath, [], {
|
|
16
27
|
stdio: ['pipe', 'pipe', 'pipe']
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAA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AC;YAClB,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED,6CAA6C;AAC7C,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACnB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;IACtD,MAAM,OAAO,EAAE,CAAC;AACpB,CAAC"}
|
package/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import { platform } from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
+
import fs from 'fs';
|
|
4
5
|
|
|
5
6
|
export interface MessageBoxOptions {
|
|
6
7
|
title?: string;
|
|
@@ -31,10 +32,21 @@ export interface MessageBoxResult {
|
|
|
31
32
|
*/
|
|
32
33
|
export async function showMessageBox(options: MessageBoxOptions): Promise<MessageBoxResult> {
|
|
33
34
|
return new Promise((resolve, reject) => {
|
|
35
|
+
const isWindows = platform() === 'win32';
|
|
36
|
+
|
|
34
37
|
// Determine the binary name based on platform
|
|
35
|
-
const binaryName =
|
|
38
|
+
const binaryName = isWindows ? 'msgernative.exe' : 'msgernative';
|
|
36
39
|
const binaryPath = path.join(import.meta.dirname, 'msger-native', 'bin', binaryName);
|
|
37
40
|
|
|
41
|
+
// Ensure the binary has execute permissions on Unix systems
|
|
42
|
+
if (!isWindows && fs.existsSync(binaryPath)) {
|
|
43
|
+
try {
|
|
44
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// Ignore permission errors if we can't set it
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
38
50
|
// Spawn the Rust binary
|
|
39
51
|
const child = spawn(binaryPath, [], {
|
|
40
52
|
stdio: ['pipe', 'pipe', 'pipe']
|
package/msger-native/build.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
4
|
import { platform, arch } from 'os';
|
|
5
|
-
import { existsSync, mkdirSync, copyFileSync, readFileSync, statSync } from 'fs';
|
|
5
|
+
import { existsSync, mkdirSync, copyFileSync, readFileSync, statSync, chmodSync } from 'fs';
|
|
6
6
|
|
|
7
7
|
function isWSL() {
|
|
8
8
|
try {
|