<p dir="auto">Tray API seems to throw TypeErrors when the path passed in is an ASAR path.</p>
<p dir="auto">Hello,</p>
<p dir="auto">Initializing a Tray menu with icon (on OSX Yosemite, so far) while using the asar method of packaging seems to be unable to find the icon.  Every combination of image paths I have tried (listed below) has resulted in the same error message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Uncaught Exception:
TypeError: Error processing argument 0.
    at TypeError (native)
    at EventEmitter.&lt;anonymous&gt; (PATH_TO_MAIN.JS:26:13)
    at EventEmitter.emit (events.js:129:20)"><pre class="notranslate"><code class="notranslate">Uncaught Exception:
TypeError: Error processing argument 0.
    at TypeError (native)
    at EventEmitter.&lt;anonymous&gt; (PATH_TO_MAIN.JS:26:13)
    at EventEmitter.emit (events.js:129:20)
</code></pre></div>
<p dir="auto">This is with <a href="mailto:Node.js@0.13.0-pre">Node.js@0.13.0-pre</a> and atom-shell@0.20.5 (again, on OSX 10.10.2 aka Yosemite).  The <code class="notranslate">main.js</code> is below. What is missing? How can I access the correct image via Tray constructor?</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var app = require('app'); 
var BrowserWindow = require('browser-window'); 
var Menu = require('menu');
var Tray = require('tray');

var mainWindow = null;
var appIcon = null;
var contextMenu = null;

app.on('window-all-closed', function() {
  if (process.platform != 'darwin')
    app.quit();
});

app.on('ready', function() {
  mainWindow = new BrowserWindow({width: 800, height: 600});
  mainWindow.loadUrl('asar://' + __dirname + '/index.html');

  // var trayimage = '/assets/img/icon.png'; // doesn't work
  // var trayimage = __dirname + '/assets/img/icon.png'; // doesn't work
  // var trayimage = 'asar:' + __dirname + '/assets/img/icon.png'; // doesn't work
  // also tried absolute path
  var trayimage = 'asar:/assets/img/icon.png'; // doesn't work
  console.log('dirname', __dirname);
  console.log('trayimage', trayimage);
  appIcon = new Tray(trayimage);
  contextMenu = Menu.buildFromTemplate([
    { label: 'Item1', type: 'radio' },
    { label: 'Item2', type: 'radio' },
    { label: 'Item3', type: 'radio', checked: true },
    { label: 'Item4', type: 'radio' },
  ]);
  appIcon.setToolTip('This is my application.');
  appIcon.setContextMenu(contextMenu);

  mainWindow.on('closed', function() {
    mainWindow = null;
  });
});"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'app'</span><span class="pl-kos">)</span><span class="pl-kos">;</span> 
<span class="pl-k">var</span> <span class="pl-v">BrowserWindow</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'browser-window'</span><span class="pl-kos">)</span><span class="pl-kos">;</span> 
<span class="pl-k">var</span> <span class="pl-v">Menu</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'menu'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-v">Tray</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'tray'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">var</span> <span class="pl-s1">mainWindow</span> <span class="pl-c1">=</span> <span class="pl-c1">null</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">appIcon</span> <span class="pl-c1">=</span> <span class="pl-c1">null</span><span class="pl-kos">;</span>
<span class="pl-k">var</span> <span class="pl-s1">contextMenu</span> <span class="pl-c1">=</span> <span class="pl-c1">null</span><span class="pl-kos">;</span>

<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'window-all-closed'</span><span class="pl-kos">,</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">platform</span> <span class="pl-c1">!=</span> <span class="pl-s">'darwin'</span><span class="pl-kos">)</span>
    <span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">quit</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'ready'</span><span class="pl-kos">,</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-s1">mainWindow</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">BrowserWindow</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">width</span>: <span class="pl-c1">800</span><span class="pl-kos">,</span> <span class="pl-c1">height</span>: <span class="pl-c1">600</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">mainWindow</span><span class="pl-kos">.</span><span class="pl-en">loadUrl</span><span class="pl-kos">(</span><span class="pl-s">'asar://'</span> <span class="pl-c1">+</span> <span class="pl-s1">__dirname</span> <span class="pl-c1">+</span> <span class="pl-s">'/index.html'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-c">// var trayimage = '/assets/img/icon.png'; // doesn't work</span>
  <span class="pl-c">// var trayimage = __dirname + '/assets/img/icon.png'; // doesn't work</span>
  <span class="pl-c">// var trayimage = 'asar:' + __dirname + '/assets/img/icon.png'; // doesn't work</span>
  <span class="pl-c">// also tried absolute path</span>
  <span class="pl-k">var</span> <span class="pl-s1">trayimage</span> <span class="pl-c1">=</span> <span class="pl-s">'asar:/assets/img/icon.png'</span><span class="pl-kos">;</span> <span class="pl-c">// doesn't work</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'dirname'</span><span class="pl-kos">,</span> <span class="pl-s1">__dirname</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">'trayimage'</span><span class="pl-kos">,</span> <span class="pl-s1">trayimage</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">appIcon</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">Tray</span><span class="pl-kos">(</span><span class="pl-s1">trayimage</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">contextMenu</span> <span class="pl-c1">=</span> <span class="pl-v">Menu</span><span class="pl-kos">.</span><span class="pl-en">buildFromTemplate</span><span class="pl-kos">(</span><span class="pl-kos">[</span>
    <span class="pl-kos">{</span> <span class="pl-c1">label</span>: <span class="pl-s">'Item1'</span><span class="pl-kos">,</span> <span class="pl-c1">type</span>: <span class="pl-s">'radio'</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span> <span class="pl-c1">label</span>: <span class="pl-s">'Item2'</span><span class="pl-kos">,</span> <span class="pl-c1">type</span>: <span class="pl-s">'radio'</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span> <span class="pl-c1">label</span>: <span class="pl-s">'Item3'</span><span class="pl-kos">,</span> <span class="pl-c1">type</span>: <span class="pl-s">'radio'</span><span class="pl-kos">,</span> <span class="pl-c1">checked</span>: <span class="pl-c1">true</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">{</span> <span class="pl-c1">label</span>: <span class="pl-s">'Item4'</span><span class="pl-kos">,</span> <span class="pl-c1">type</span>: <span class="pl-s">'radio'</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">appIcon</span><span class="pl-kos">.</span><span class="pl-en">setToolTip</span><span class="pl-kos">(</span><span class="pl-s">'This is my application.'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">appIcon</span><span class="pl-kos">.</span><span class="pl-en">setContextMenu</span><span class="pl-kos">(</span><span class="pl-s1">contextMenu</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

  <span class="pl-s1">mainWindow</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'closed'</span><span class="pl-kos">,</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-s1">mainWindow</span> <span class="pl-c1">=</span> <span class="pl-c1">null</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>