improve OpenFileFolder
This commit is contained in:
parent
1591430742
commit
64f0610ed7
@ -119,8 +119,14 @@ func (a *App) CopyFile(src string, dst string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) OpenFileFolder(path string) error {
|
||||
absPath, err := filepath.Abs(a.exDir + path)
|
||||
func (a *App) OpenFileFolder(path string, relative bool) error {
|
||||
var absPath string
|
||||
var err error
|
||||
if relative {
|
||||
absPath, err = filepath.Abs(a.exDir + path)
|
||||
} else {
|
||||
absPath, err = filepath.Abs(path)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ export const Downloads: FC = observer(() => {
|
||||
ContinueDownload(status.url);
|
||||
}} />}
|
||||
<ToolTipButton desc={t('Open Folder')} icon={<Folder20Regular />} onClick={() => {
|
||||
OpenFileFolder(`${commonStore.settings.customModelsPath}/${status.name}`);
|
||||
OpenFileFolder(status.path, false);
|
||||
}} />
|
||||
</div>
|
||||
</Field>
|
||||
|
@ -142,7 +142,7 @@ const columns: TableColumnDefinition<ModelSourceItem>[] = [
|
||||
{
|
||||
item.isLocal &&
|
||||
<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 &&
|
||||
|
2
frontend/wailsjs/go/backend_golang/App.d.ts
generated
vendored
2
frontend/wailsjs/go/backend_golang/App.d.ts
generated
vendored
@ -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 OpenFileFolder(arg1:string):Promise<void>;
|
||||
export function OpenFileFolder(arg1:string,arg2:boolean):Promise<void>;
|
||||
|
||||
export function PauseDownload(arg1:string):Promise<void>;
|
||||
|
||||
|
4
frontend/wailsjs/go/backend_golang/App.js
generated
4
frontend/wailsjs/go/backend_golang/App.js
generated
@ -46,8 +46,8 @@ export function ListDirFiles(arg1) {
|
||||
return window['go']['backend_golang']['App']['ListDirFiles'](arg1);
|
||||
}
|
||||
|
||||
export function OpenFileFolder(arg1) {
|
||||
return window['go']['backend_golang']['App']['OpenFileFolder'](arg1);
|
||||
export function OpenFileFolder(arg1, arg2) {
|
||||
return window['go']['backend_golang']['App']['OpenFileFolder'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function PauseDownload(arg1) {
|
||||
|
Loading…
Reference in New Issue
Block a user