fix resources path

This commit is contained in:
pompurin404 2024-08-08 11:23:54 +08:00
parent c399e00aa4
commit 6b537085b4
No known key found for this signature in database
3 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "mihomo-party",
"version": "0.2.2",
"version": "0.2.3",
"description": "Mihomo Party",
"main": "./out/main/index.js",
"author": "mihomo-party",

View File

@ -11,9 +11,13 @@ export function exePath(): string {
export function resourcesDir(): string {
if (is.dev) {
return path.join(__dirname, '../../resources')
} else {
if (app.getAppPath().endsWith('asar')) {
return process.resourcesPath
} else {
return path.join(app.getAppPath(), 'resources')
}
}
}
export function resourcesFilesDir(): string {

View File

@ -55,9 +55,9 @@ const DNS: React.FC = () => {
}
const handleHostsChange = (domain: string, value: string, index: number): void => {
const processValue = (val: string): string | string[] =>
val.includes(',') ? val.split(',').map(s => s.trim()) : val.trim()
val.includes(',') ? val.split(',').map((s) => s.trim()) : val.trim()
const isEmpty = (d: string, v: string | string[]): boolean =>
d === '' && (Array.isArray(v) ? v.every(item => item === '') : v === '')
d === '' && (Array.isArray(v) ? v.every((item) => item === '') : v === '')
const newHosts = [...values.hosts]
if (!isEmpty(domain.trim(), processValue(value))) {