mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-20 18:23:21 +00:00
Updated message-box for freebsd
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -158,6 +158,7 @@ function linux_messageBox()
|
|||||||
child.stdin.write("whereis zenity | awk '{ print $2 }'\nexit\n");
|
child.stdin.write("whereis zenity | awk '{ print $2 }'\nexit\n");
|
||||||
child.waitExit();
|
child.waitExit();
|
||||||
zenity = child.stdout.str.trim();
|
zenity = child.stdout.str.trim();
|
||||||
|
if (process.platform == 'freebsd' && zenity == '' && require('fs').existsSync('/usr/local/bin/zenity')) { zenity = '/usr/local/bin/zenity'; }
|
||||||
if (zenity != '')
|
if (zenity != '')
|
||||||
{
|
{
|
||||||
// GNOME/ZENITY
|
// GNOME/ZENITY
|
||||||
@@ -189,6 +190,7 @@ function linux_messageBox()
|
|||||||
child.stdin.write("whereis kdialog | awk '{ print $2 }'\nexit\n");
|
child.stdin.write("whereis kdialog | awk '{ print $2 }'\nexit\n");
|
||||||
child.waitExit();
|
child.waitExit();
|
||||||
kdialog = child.stdout.str.trim();
|
kdialog = child.stdout.str.trim();
|
||||||
|
if (process.platform == 'freebsd' && kdialog == '' && require('fs').existsSync('/usr/local/bin/kdialog')) { kdialog = '/usr/local/bin/kdialog'; }
|
||||||
if (kdialog == '') { ret._rej('Platform not supported (zenity or kdialog not found)'); return (ret); }
|
if (kdialog == '') { ret._rej('Platform not supported (zenity or kdialog not found)'); return (ret); }
|
||||||
if (process.env['DISPLAY'])
|
if (process.env['DISPLAY'])
|
||||||
{
|
{
|
||||||
@@ -198,7 +200,7 @@ function linux_messageBox()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var xdg = require('user-sessions').findEnv(uid, 'XDG_RUNTIME_DIR');
|
var xdg = require('user-sessions').findEnv(uid, 'XDG_RUNTIME_DIR');
|
||||||
if (!xinfo || !xinfo.display || !xinfo.xauthority || !xdg) { ret._rej('Interal Error, could not determine X11/XDG env'); return (ret); }
|
if (!xinfo || !xinfo.display || !xinfo.xauthority) { ret._rej('Interal Error, could not determine X11/XDG env'); return (ret); }
|
||||||
ret.child = require('child_process').execFile(kdialog, ['kdialog', '--title', title, '--yesno', caption], { uid: uid, env: { DISPLAY: xinfo.display, XAUTHORITY: xinfo.xauthority, XDG_RUNTIME_DIR: xdg } });
|
ret.child = require('child_process').execFile(kdialog, ['kdialog', '--title', title, '--yesno', caption], { uid: uid, env: { DISPLAY: xinfo.display, XAUTHORITY: xinfo.xauthority, XDG_RUNTIME_DIR: xdg } });
|
||||||
ret.child.promise = ret;
|
ret.child.promise = ret;
|
||||||
}
|
}
|
||||||
@@ -220,10 +222,6 @@ function linux_messageBox()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
return (ret);
|
return (ret);
|
||||||
|
|
||||||
|
|
||||||
console.log(child.stdout.str.trim() == '');
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,6 +468,7 @@ switch(process.platform)
|
|||||||
module.exports = new messageBox();
|
module.exports = new messageBox();
|
||||||
break;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
|
case 'freebsd':
|
||||||
module.exports = new linux_messageBox();
|
module.exports = new linux_messageBox();
|
||||||
break;
|
break;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
|
|||||||
Reference in New Issue
Block a user