Stop using __dirname to avoid confusing

This commit is contained in:
Yuya Ochiai 2017-03-06 23:31:06 +09:00
parent 3b4a1dfca9
commit 1ab0859ac1
7 changed files with 9 additions and 9 deletions

View file

@ -100,7 +100,7 @@ const MattermostView = React.createClass({
osLocale().then((locale) => {
if (locale === 'ja_JP') {
applyCssFile(__dirname + '/css/jp_fonts.css');
applyCssFile(remote.app.getAppPath() + '/css/jp_fonts.css');
}
});
}

View file

@ -18,7 +18,7 @@ const appLauncher = new AutoLaunch({
function backToIndex(index) {
const target = typeof index === 'undefined' ? 0 : index;
const indexURL = remote.getGlobal('isDev') ? 'http://localhost:8080/browser/index.html' : `file://${__dirname}/index.html`;
const indexURL = remote.getGlobal('isDev') ? 'http://localhost:8080/browser/index.html' : `file://${remote.app.getAppPath()}/browser/index.html`;
remote.getCurrentWindow().loadURL(`${indexURL}?index=${target}`);
}

View file

@ -490,7 +490,7 @@ app.on('ready', () => {
}
// and load the index.html of the app.
const indexURL = global.isDev ? 'http://localhost:8080/browser/index.html' : 'file://' + __dirname + '/browser/index.html';
const indexURL = global.isDev ? 'http://localhost:8080/browser/index.html' : `file://${app.getAppPath()}/browser/index.html`;
mainWindow.loadURL(indexURL);
// Set application menu

View file

@ -4,7 +4,7 @@ const electron = require('electron');
const Menu = electron.Menu;
function createTemplate(mainWindow, config, isDev) {
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : 'file://' + __dirname + '/browser/settings.html';
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : `file://${electron.app.getAppPath()}/browser/settings.html`;
const separatorItem = {
type: 'separator'

View file

@ -6,7 +6,7 @@ const {
} = require('electron');
function createTemplate(mainWindow, config, isDev) {
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : `file://${__dirname}/browser/settings.html`;
const settingsURL = isDev ? 'http://localhost:8080/browser/settings.html' : `file://${app.getAppPath()}/browser/settings.html`;
var template = [
...config.teams.slice(0, 9).map((team, i) => {
return {

View file

@ -9,8 +9,8 @@ module.exports = merge(base, {
filename: './src/[name]_bundle.js'
},
node: {
__filename: false,
__dirname: false
__filename: true,
__dirname: true
},
target: 'electron-main',
externals: {

View file

@ -28,8 +28,8 @@ module.exports = merge(base, {
}]
},
node: {
__filename: false,
__dirname: false
__filename: true,
__dirname: true
},
target: 'electron-renderer',
devServer: {