mirror of
https://github.com/danbulant/node-x11
synced 2026-05-22 05:49:11 +00:00
better platform detection
This commit is contained in:
parent
265e2b0bed
commit
c6da7dd7b7
1 changed files with 13 additions and 4 deletions
|
|
@ -182,17 +182,26 @@ XClient.prototype.startHandshake = function()
|
|||
});
|
||||
}
|
||||
|
||||
var platformDefaultTransport = {
|
||||
win32: 'tcp',
|
||||
win64: 'tcp',
|
||||
cygwin: 'tcp',
|
||||
linux: 'unix'
|
||||
// TODO: check process.platform on SmartMachine solaris box
|
||||
}
|
||||
|
||||
module.exports.createClient = function()
|
||||
{
|
||||
// TODO: parse $DISPLAY
|
||||
|
||||
// open stream
|
||||
// TODO: better platform matching
|
||||
var platform = process.platform;
|
||||
var stream;
|
||||
if (platform == 'cygwin')
|
||||
var defaultTransportName = platformDefaultTransport[process.platform];
|
||||
console.error('Cunnecting using ' + defaultTransportName + ' socket');
|
||||
// use tcp if stated explicitly or if not defined at all
|
||||
if (!defaultTransportName || defaultTransportName == 'tcp')
|
||||
stream = net.createConnection(6000);
|
||||
else
|
||||
if (defaultTransportName == 'unix')
|
||||
stream = net.createConnection('/tmp/.X11-unix/X0');
|
||||
|
||||
return new XClient(stream);
|
||||
|
|
|
|||
Loading…
Reference in a new issue