improve OpenFileFolder

This commit is contained in:
josc146 2023-06-14 21:11:08 +08:00
parent 1591430742
commit 64f0610ed7
5 changed files with 13 additions and 7 deletions

View File

@ -119,8 +119,14 @@ func (a *App) CopyFile(src string, dst string) error {
return nil return nil
} }
func (a *App) OpenFileFolder(path string) error { func (a *App) OpenFileFolder(path string, relative bool) error {
absPath, err := filepath.Abs(a.exDir + path) var absPath string
var err error
if relative {
absPath, err = filepath.Abs(a.exDir + path)
} else {
absPath, err = filepath.Abs(path)
}
if err != nil { if err != nil {
return err return err
} }

View File

@ -62,7 +62,7 @@ export const Downloads: FC = observer(() => {
ContinueDownload(status.url); ContinueDownload(status.url);
}} />} }} />}
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => { <ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
OpenFileFolder(`${commonStore.settings.customModelsPath}/${status.name}`); OpenFileFolder(status.path, false);
}} /> }} />
</div> </div>
</Field> </Field>

View File

@ -142,7 +142,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
{ {
item.isLocal && item.isLocal &&
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => { <ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
OpenFileFolder(`${commonStore.settings.customModelsPath}/${item.name}`); OpenFileFolder(`${commonStore.settings.customModelsPath}/${item.name}`, true);
}} /> }} />
} }
{item.downloadUrl && !item.isLocal && {item.downloadUrl && !item.isLocal &&

View File

@ -24,7 +24,7 @@ export function InstallPyDep(arg1:string,arg2:boolean):Promise<string>;
export function ListDirFiles(arg1:string):Promise<Array<backend_golang.FileInfo>>; export function ListDirFiles(arg1:string):Promise<Array<backend_golang.FileInfo>>;
export function OpenFileFolder(arg1:string):Promise<void>; export function OpenFileFolder(arg1:string,arg2:boolean):Promise<void>;
export function PauseDownload(arg1:string):Promise<void>; export function PauseDownload(arg1:string):Promise<void>;

View File

@ -46,8 +46,8 @@ export function ListDirFiles(arg1) {
return window['go']['backend_golang']['App']['ListDirFiles'](arg1); return window['go']['backend_golang']['App']['ListDirFiles'](arg1);
} }
export function OpenFileFolder(arg1) { export function OpenFileFolder(arg1, arg2) {
return window['go']['backend_golang']['App']['OpenFileFolder'](arg1); return window['go']['backend_golang']['App']['OpenFileFolder'](arg1, arg2);
} }
export function PauseDownload(arg1) { export function PauseDownload(arg1) {