improve update process for macOS and Linux
This commit is contained in:
parent
a95fbbbd78
commit
b7c34b0d42
@ -53,12 +53,14 @@ func (a *App) UpdateApp(url string) (broken bool, err error) {
|
|||||||
}
|
}
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
name, err := os.Executable()
|
if runtime.GOOS == "windows" {
|
||||||
if err != nil {
|
name, err := os.Executable()
|
||||||
return false, err
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
exec.Command(name, os.Args[1:]...).Start()
|
||||||
|
wruntime.Quit(a.ctx)
|
||||||
}
|
}
|
||||||
exec.Command(name, os.Args[1:]...).Start()
|
|
||||||
wruntime.Quit(a.ctx)
|
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,5 +141,6 @@
|
|||||||
"Current Strategy": "当前Strategy",
|
"Current Strategy": "当前Strategy",
|
||||||
"MacOS is not yet supported for performing this operation, please do it manually.": "MacOS尚未支持此操作, 请手动执行",
|
"MacOS is not yet supported for performing this operation, please do it manually.": "MacOS尚未支持此操作, 请手动执行",
|
||||||
"Linux is not yet supported for performing this operation, please do it manually.": "Linux尚未支持此操作, 请手动执行",
|
"Linux is not yet supported for performing this operation, please do it manually.": "Linux尚未支持此操作, 请手动执行",
|
||||||
"On Linux system, you must manually install python dependencies.": "在Linux系统下, 你必须手动安装python依赖"
|
"On Linux system, you must manually install python dependencies.": "在Linux系统下, 你必须手动安装python依赖",
|
||||||
|
"Update completed, please restart the program.": "更新完成, 请重启程序"
|
||||||
}
|
}
|
@ -16,7 +16,6 @@ import { Button } from '@fluentui/react-components';
|
|||||||
import { Language, Languages, SettingsType } from '../pages/Settings';
|
import { Language, Languages, SettingsType } from '../pages/Settings';
|
||||||
import { ModelSourceItem } from '../pages/Models';
|
import { ModelSourceItem } from '../pages/Models';
|
||||||
import { ModelConfig, ModelParameters } from '../pages/Configs';
|
import { ModelConfig, ModelParameters } from '../pages/Configs';
|
||||||
import { BrowserOpenURL } from '../../wailsjs/runtime';
|
|
||||||
|
|
||||||
export type Cache = {
|
export type Cache = {
|
||||||
models: ModelSourceItem[]
|
models: ModelSourceItem[]
|
||||||
@ -250,24 +249,27 @@ export async function checkUpdate(notifyEvenLatest: boolean = false) {
|
|||||||
`https://gitee.com/josc146/RWKV-Runner/releases/download/${versionTag}/${asset.name}`;
|
`https://gitee.com/josc146/RWKV-Runner/releases/download/${versionTag}/${asset.name}`;
|
||||||
toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => {
|
toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => {
|
||||||
DeleteFile('cache.json');
|
DeleteFile('cache.json');
|
||||||
if (commonStore.platform != 'darwin') {
|
toast(t('Downloading update, please wait. If it is not completed, please manually download the program from GitHub and replace the original program.'), {
|
||||||
toast(t('Downloading update, please wait. If it is not completed, please manually download the program from GitHub and replace the original program.'), {
|
type: 'info',
|
||||||
type: 'info',
|
position: 'bottom-left',
|
||||||
position: 'bottom-left',
|
autoClose: 30000
|
||||||
autoClose: 20000
|
});
|
||||||
});
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
UpdateApp(updateUrl).then(() => {
|
||||||
UpdateApp(updateUrl).catch((e) => {
|
toast(t('Update completed, please restart the program.'), {
|
||||||
toast(t('Update Error') + ' - ' + e.message || e, {
|
type: 'success',
|
||||||
type: 'error',
|
|
||||||
position: 'bottom-left',
|
position: 'bottom-left',
|
||||||
autoClose: false
|
autoClose: false
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
}).catch((e) => {
|
||||||
|
toast(t('Update Error') + ' - ' + e.message || e, {
|
||||||
|
type: 'error',
|
||||||
|
position: 'bottom-left',
|
||||||
|
autoClose: false
|
||||||
});
|
});
|
||||||
}, 500);
|
});
|
||||||
} else {
|
}, 500);
|
||||||
BrowserOpenURL(updateUrl);
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
autoClose: false,
|
autoClose: false,
|
||||||
position: 'bottom-left'
|
position: 'bottom-left'
|
||||||
|
Loading…
Reference in New Issue
Block a user