diff --git a/backend-golang/utils.go b/backend-golang/utils.go index 690458b..ffb967c 100644 --- a/backend-golang/utils.go +++ b/backend-golang/utils.go @@ -28,11 +28,11 @@ func Cmd(args ...string) (string, error) { return "", err } - path, err := filepath.Abs(args[0]) - if err != nil { - return "", err + for _, arg := range args { + if strings.Contains(arg, " ") && strings.Contains(cmdHelper, " ") { + return "", errors.New("path contains space") // golang bug https://github.com/golang/go/issues/17149#issuecomment-473976818 + } } - args[0] = path cmd := exec.Command(cmdHelper, args...) out, err := cmd.CombinedOutput() diff --git a/frontend/src/_locales/zh-hans/main.json b/frontend/src/_locales/zh-hans/main.json index 5334833..c90e615 100644 --- a/frontend/src/_locales/zh-hans/main.json +++ b/frontend/src/_locales/zh-hans/main.json @@ -133,5 +133,7 @@ "Advanced": "高级", "Custom Python Path": "自定义Python路径", "Custom Models Path": "自定义模型路径", - "MacOS is not supported yet, please convert manually.": "暂不支持MacOS, 请手动转换" + "MacOS is not supported yet, please convert manually.": "暂不支持MacOS, 请手动转换", + "Microsoft Visual C++ Redistributable is not installed, would you like to download it?": "微软VC++组件未安装, 是否下载?", + "Path Cannot Contain Space": "路径不能包含空格" } \ No newline at end of file diff --git a/frontend/src/pages/Configs.tsx b/frontend/src/pages/Configs.tsx index 4526c96..c22ac4d 100644 --- a/frontend/src/pages/Configs.tsx +++ b/frontend/src/pages/Configs.tsx @@ -835,9 +835,9 @@ export const Configs: FC = observer(() => { } /> { - if(commonStore.platform=="darwin"){ - toast(t("MacOS is not supported yet, please convert manually."), { type: 'info' }) - return + if (commonStore.platform == 'darwin') { + toast(t('MacOS is not supported yet, please convert manually.'), { type: 'info' }); + return; } const modelPath = `${commonStore.settings.customModelsPath}/${selectedConfig.modelParameters.modelName}`; @@ -849,7 +849,11 @@ export const Configs: FC = observer(() => { toast(`${t('Convert Success')} - ${newModelPath}`, { type: 'success' }); refreshLocalModels({ models: commonStore.modelSourceList }, false); }).catch(e => { - toast(`${t('Convert Failed')} - ${e.message || e}`, { type: 'error' }); + const errMsg = e.message || e; + if (errMsg.includes('path contains space')) + toast(`${t('Convert Failed')} - ${t('Path Cannot Contain Space')}`, { type: 'error' }); + else + toast(`${t('Convert Failed')} - ${e.message || e}`, { type: 'error' }); }); setTimeout(WindowShow, 1000); } else { diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx index 3c781fa..db3ea75 100644 --- a/frontend/src/pages/Settings.tsx +++ b/frontend/src/pages/Settings.tsx @@ -129,7 +129,7 @@ export const Settings: FC = observer(() => { }} /> } /> } - {