From 0c6d4b59c009ee472c0fd4c177e604a64d720fad Mon Sep 17 00:00:00 2001 From: Igor Gassmann Date: Thu, 22 Mar 2018 14:52:07 -0400 Subject: [PATCH] Revert "fix: __static path not resolving on development environment (#1165)" This reverts commit 4b41c6335d69f669b8dc26d49b91f6aaffceea29. --- .eslintrc.json | 1 + CHANGELOG.md | 1 - src/renderer/app.js | 10 ++++++++++ src/renderer/lbry.js | 2 +- src/renderer/redux/selectors/settings.js | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 64d9f5c30..f7dd140c7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -20,6 +20,7 @@ }, "globals": { "__static": true, + "staticResourcesPath": true, "__": true, "__n": true, "app": true diff --git a/CHANGELOG.md b/CHANGELOG.md index d19be69cb..f689a27b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). * LBRY URLs not working on Linux ([#1120](https://github.com/lbryio/lbry-app/issues/1120)) * Fix Windows notifications not showing ([#1145](https://github.com/lbryio/lbry-app/pull/1145)) * Fix export issues ([#1163](https://github.com/lbryio/lbry-app/pull/1163)) - * Fix __static path not resolving on development environment diff --git a/src/renderer/app.js b/src/renderer/app.js index 9a49e51d7..9933b47eb 100644 --- a/src/renderer/app.js +++ b/src/renderer/app.js @@ -22,6 +22,16 @@ const app = { }, }; +// Workaround for https://github.com/electron-userland/electron-webpack/issues/52 +if (!isDev) { + window.staticResourcesPath = Path.join(remote.app.getAppPath(), '../static').replace( + /\\/g, + '\\\\' + ); +} else { + window.staticResourcesPath = ''; +} + // eslint-disable-next-line no-underscore-dangle global.__ = i18n.__; // eslint-disable-next-line no-underscore-dangle diff --git a/src/renderer/lbry.js b/src/renderer/lbry.js index 3505f1c84..79855b4ce 100644 --- a/src/renderer/lbry.js +++ b/src/renderer/lbry.js @@ -172,7 +172,7 @@ Lbry.publishDeprecated = (params, fileListedCallback, publishedCallback, errorCa ); }; -Lbry.imagePath = file => `file://${__static}/img/${file}`; +Lbry.imagePath = file => `${staticResourcesPath}/img/${file}`; Lbry.getMediaType = (contentType, fileName) => { if (contentType) { diff --git a/src/renderer/redux/selectors/settings.js b/src/renderer/redux/selectors/settings.js index 348df4b2e..9c90cfac2 100644 --- a/src/renderer/redux/selectors/settings.js +++ b/src/renderer/redux/selectors/settings.js @@ -30,6 +30,6 @@ export const selectThemePath = createSelector( selectIsNight, (theme, automaticDarkModeEnabled, isNight) => { const dynamicTheme = automaticDarkModeEnabled && isNight ? 'dark' : theme; - return `file://${__static}/themes/${dynamicTheme || 'light'}.css`; + return `${staticResourcesPath}/themes/${dynamicTheme || 'light'}.css`; } );