From 2de80571d88f1ce4805ba10feb01df924897ced4 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 14 Oct 2014 19:19:55 +0800 Subject: [PATCH] Add spec for #694 --- spec/asar-spec.coffee | 19 +++++++++++++++++++ spec/fixtures/asar/web.asar | Bin 0 -> 201 bytes 2 files changed, 19 insertions(+) create mode 100644 spec/fixtures/asar/web.asar diff --git a/spec/asar-spec.coffee b/spec/asar-spec.coffee index d1d4c6d996..2cfab88568 100644 --- a/spec/asar-spec.coffee +++ b/spec/asar-spec.coffee @@ -373,3 +373,22 @@ describe 'asar package', -> error: (err) -> assert.equal err.status, 404 done() + + it 'sets __dirname correctly', (done) -> + url = require 'url' + remote = require 'remote' + ipc = remote.require 'ipc' + BrowserWindow = remote.require 'browser-window' + + after -> + w.destroy() + ipc.removeAllListeners 'dirname' + + w = new BrowserWindow(show: false, width: 400, height: 400) + p = path.resolve fixtures, 'asar', 'web.asar', 'index.html' + u = url.format protocol: 'asar', slashed: false, pathname: p + console.log u + w.loadUrl u + ipc.on 'dirname', (event, dirname) -> + assert.equal dirname, path.dirname(p) + done() diff --git a/spec/fixtures/asar/web.asar b/spec/fixtures/asar/web.asar new file mode 100644 index 0000000000000000000000000000000000000000..0c7a788e759dc131689de6fb977bbbba4d795260 GIT binary patch literal 201 zcmXYq%L;=q5Jg>dV~Pcnk=#Fgaue! zENl6PA6FoC!?kM{Fk5*|q4WvS_@0%^0ToIQyhj?5syg@Z>F4bD<23Bl HvBUlYoEALH literal 0 HcmV?d00001