修复自定义主题背景路径存在空格时无法显示的问题
parent
7daa626d55
commit
a6fd41900f
|
@ -177,8 +177,7 @@ export const sortInsert = (arr: Array<{ num: number, data: any }>, data: { num:
|
||||||
}
|
}
|
||||||
|
|
||||||
export const encodePath = (path: string) => {
|
export const encodePath = (path: string) => {
|
||||||
// https://github.com/lyswhut/lx-music-desktop/issues/963
|
return encodeURI(path.replaceAll('\\', '/'))
|
||||||
return path.replaceAll('%', '%25')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,3 +36,8 @@ export const clipboardReadText = (): string => {
|
||||||
return clipboard.readText()
|
return clipboard.readText()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const encodePath = (path: string) => {
|
||||||
|
// https://github.com/lyswhut/lx-music-desktop/issues/963
|
||||||
|
return path.replaceAll('%', '%25')
|
||||||
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { BrowserWindow } from 'electron'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { openDevTools as handleOpenDevTools } from '@main/utils'
|
import { openDevTools as handleOpenDevTools } from '@main/utils'
|
||||||
import { encodePath } from '@common/utils'
|
import { encodePath } from '@common/utils/electron'
|
||||||
|
|
||||||
let browserWindow: Electron.BrowserWindow | null = null
|
let browserWindow: Electron.BrowserWindow | null = null
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { BrowserWindow } from 'electron'
|
import { BrowserWindow } from 'electron'
|
||||||
import { debounce, encodePath, isLinux } from '@common/utils'
|
import { debounce, isLinux } from '@common/utils'
|
||||||
import { getLyricWindowBounds } from './utils'
|
import { getLyricWindowBounds } from './utils'
|
||||||
import { mainSend } from '@common/mainIpc'
|
import { mainSend } from '@common/mainIpc'
|
||||||
|
import { encodePath } from '@common/utils/electron'
|
||||||
|
|
||||||
// require('./event')
|
// require('./event')
|
||||||
// require('./rendererEvent')
|
// require('./rendererEvent')
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { BrowserWindow, dialog } from 'electron'
|
import { BrowserWindow, dialog } from 'electron'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { createTaskBarButtons, getWindowSizeInfo } from './utils'
|
import { createTaskBarButtons, getWindowSizeInfo } from './utils'
|
||||||
import { encodePath, isLinux, isWin } from '@common/utils'
|
import { isLinux, isWin } from '@common/utils'
|
||||||
import { openDevTools as handleOpenDevTools } from '@main/utils'
|
import { openDevTools as handleOpenDevTools } from '@main/utils'
|
||||||
import { mainSend } from '@common/mainIpc'
|
import { mainSend } from '@common/mainIpc'
|
||||||
import { sendFocus, sendTaskbarButtonClick } from './rendererEvent'
|
import { sendFocus, sendTaskbarButtonClick } from './rendererEvent'
|
||||||
|
import { encodePath } from '@common/utils/electron'
|
||||||
|
|
||||||
let browserWindow: Electron.BrowserWindow | null = null
|
let browserWindow: Electron.BrowserWindow | null = null
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ export const getTheme = () => {
|
||||||
theme.config.extInfo['--background-image'] =
|
theme.config.extInfo['--background-image'] =
|
||||||
isUrl(theme.config.extInfo['--background-image'])
|
isUrl(theme.config.extInfo['--background-image'])
|
||||||
? `url(${theme.config.extInfo['--background-image']})`
|
? `url(${theme.config.extInfo['--background-image']})`
|
||||||
: `url(file:///${encodePath(joinPath(global.lxDataPath, 'theme_images', theme.config.extInfo['--background-image']).replaceAll('\\', '/'))})`
|
: `url(file:///${encodePath(joinPath(global.lxDataPath, 'theme_images', theme.config.extInfo['--background-image']))})`
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
themeId = global.lx.appSetting['theme.id'] == 'auto' && shouldUseDarkColors ? 'black' : 'green'
|
themeId = global.lx.appSetting['theme.id'] == 'auto' && shouldUseDarkColors ? 'black' : 'green'
|
||||||
|
|
Loading…
Reference in New Issue