1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

fix path Linux

This commit is contained in:
AWolf81
2019-05-30 09:10:04 -07:00
committed by Junyoung Choi
parent 38fcee35c2
commit ba6eb4f26f
4 changed files with 13 additions and 6 deletions

View File

@@ -45,6 +45,7 @@ const CSS_FILES = [
`${appPath}/node_modules/codemirror/lib/codemirror.css`, `${appPath}/node_modules/codemirror/lib/codemirror.css`,
`${appPath}/node_modules/react-image-carousel/lib/css/main.min.css` `${appPath}/node_modules/react-image-carousel/lib/css/main.min.css`
] ]
const win = global.process.platform === 'win32'
function buildStyle ( function buildStyle (
fontFamily, fontFamily,
@@ -677,7 +678,9 @@ export default class MarkdownPreview extends React.Component {
GetCodeThemeLink (name) { GetCodeThemeLink (name) {
const theme = consts.THEMES.find(theme => theme.name === name) const theme = consts.THEMES.find(theme => theme.name === name)
return theme ? theme.path : `${appPath}/node_modules/codemirror/theme/elegant.css` return theme
? (win ? theme.path : `../${theme.path}`)
: `${appPath}/node_modules/codemirror/theme/elegant.css`
} }
rewriteIframe () { rewriteIframe () {

View File

@@ -7,9 +7,12 @@ const CODEMIRROR_THEME_PATH = 'node_modules/codemirror/theme'
const CODEMIRROR_EXTRA_THEME_PATH = 'extra_scripts/codemirror/theme' const CODEMIRROR_EXTRA_THEME_PATH = 'extra_scripts/codemirror/theme'
const isProduction = process.env.NODE_ENV === 'production' const isProduction = process.env.NODE_ENV === 'production'
const exePath = path.dirname(app.getPath('exe'))
const appPath = path.join(exePath, 'resources', 'app')
const paths = [ const paths = [
isProduction ? path.join(app.getAppPath(), CODEMIRROR_THEME_PATH) : path.resolve(CODEMIRROR_THEME_PATH), isProduction ? path.join(appPath, CODEMIRROR_THEME_PATH) : path.resolve(CODEMIRROR_THEME_PATH),
isProduction ? path.join(app.getAppPath(), CODEMIRROR_EXTRA_THEME_PATH) : path.resolve(CODEMIRROR_EXTRA_THEME_PATH) isProduction ? path.join(appPath, CODEMIRROR_EXTRA_THEME_PATH) : path.resolve(CODEMIRROR_EXTRA_THEME_PATH)
] ]
const themes = paths const themes = paths

View File

@@ -142,7 +142,7 @@ function get () {
const theme = consts.THEMES.find(theme => theme.name === config.editor.theme) const theme = consts.THEMES.find(theme => theme.name === config.editor.theme)
if (theme) { if (theme) {
editorTheme.setAttribute('href', theme.path) editorTheme.setAttribute('href', win ? theme.path : `../${theme.path}`)
} else { } else {
config.editor.theme = 'default' config.editor.theme = 'default'
} }
@@ -190,7 +190,7 @@ function set (updates) {
const newTheme = consts.THEMES.find(theme => theme.name === newConfig.editor.theme) const newTheme = consts.THEMES.find(theme => theme.name === newConfig.editor.theme)
if (newTheme) { if (newTheme) {
editorTheme.setAttribute('href', newTheme.path) editorTheme.setAttribute('href', win ? newTheme.path : `../${newTheme.path}`)
} }
ipcRenderer.send('config-renew', { ipcRenderer.send('config-renew', {

View File

@@ -14,6 +14,7 @@ import { getLanguages } from 'browser/lib/Languages'
import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily' import normalizeEditorFontFamily from 'browser/lib/normalizeEditorFontFamily'
const OSX = global.process.platform === 'darwin' const OSX = global.process.platform === 'darwin'
const win = global.process.platform === 'win32'
const electron = require('electron') const electron = require('electron')
const ipc = electron.ipcRenderer const ipc = electron.ipcRenderer
@@ -135,7 +136,7 @@ class UiTab extends React.Component {
const theme = consts.THEMES.find(theme => theme.name === newCodemirrorTheme) const theme = consts.THEMES.find(theme => theme.name === newCodemirrorTheme)
if (theme) { if (theme) {
checkHighLight.setAttribute('href', theme.path) checkHighLight.setAttribute('href', win ? theme.path : `../${theme.path}`)
} }
} }