Fix for windows
This commit is contained in:
2 files changed
+25
-4
No files matched your search
@@ -31,7 +31,7 @@
|
|||||||
"fs:allow-applocaldata-write",
|
"fs:allow-applocaldata-write",
|
||||||
{
|
{
|
||||||
"identifier": "fs:scope",
|
"identifier": "fs:scope",
|
||||||
"allow": [{ "path": "$APPLOCALDATA/game/**" }]
|
"allow": [{ "path": "$APPLOCALDATA/game/**" }, { "path": "$APPCONFIG/versions.json" }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identifier": "opener:allow-open-path",
|
"identifier": "opener:allow-open-path",
|
||||||
|
|||||||
+24
-3
@@ -17,6 +17,7 @@ import {
|
|||||||
} from '@tauri-apps/plugin-notification'
|
} from '@tauri-apps/plugin-notification'
|
||||||
import {
|
import {
|
||||||
BaseDirectory,
|
BaseDirectory,
|
||||||
|
copyFile,
|
||||||
exists,
|
exists,
|
||||||
readTextFile,
|
readTextFile,
|
||||||
remove
|
remove
|
||||||
@@ -280,6 +281,29 @@ export default function RootLayout ({
|
|||||||
setLoadingText('Failed to download versions list.')
|
setLoadingText('Failed to download versions list.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const legacyOptions = {
|
||||||
|
baseDir: BaseDirectory.AppLocalData
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
platform() == 'windows' &&
|
||||||
|
(await exists('versions.json', legacyOptions))
|
||||||
|
) {
|
||||||
|
if (
|
||||||
|
await exists('versions.json', {
|
||||||
|
baseDir: BaseDirectory.AppConfig
|
||||||
|
})
|
||||||
|
)
|
||||||
|
await remove('versions.json', {
|
||||||
|
baseDir: BaseDirectory.AppConfig
|
||||||
|
})
|
||||||
|
|
||||||
|
await copyFile('versions.json', 'versions.json', {
|
||||||
|
fromPathBaseDir: BaseDirectory.AppLocalData,
|
||||||
|
toPathBaseDir: BaseDirectory.AppConfig
|
||||||
|
})
|
||||||
|
await remove('versions.json', legacyOptions)
|
||||||
|
}
|
||||||
|
|
||||||
const settingsLocal = await load('settings.json', {
|
const settingsLocal = await load('settings.json', {
|
||||||
autoSave: true,
|
autoSave: true,
|
||||||
defaults: {
|
defaults: {
|
||||||
@@ -301,9 +325,6 @@ export default function RootLayout ({
|
|||||||
})
|
})
|
||||||
settingsLocal.set('version', client)
|
settingsLocal.set('version', client)
|
||||||
versionsLocal.set('version', client)
|
versionsLocal.set('version', client)
|
||||||
const legacyOptions = {
|
|
||||||
baseDir: BaseDirectory.AppLocalData
|
|
||||||
}
|
|
||||||
if (await exists('config.json', legacyOptions)) {
|
if (await exists('config.json', legacyOptions)) {
|
||||||
const config = await readTextFile('config.json', legacyOptions)
|
const config = await readTextFile('config.json', legacyOptions)
|
||||||
const raw = JSON.parse(config)
|
const raw = JSON.parse(config)
|
||||||
|
|||||||
Reference in new issue
Block a user