From 95c2fd88a4b2e38451a786784644dc3ce2d0f184 Mon Sep 17 00:00:00 2001 From: Yixue Wang Date: Fri, 26 Apr 2024 14:18:38 +0800 Subject: [PATCH] feat: support trash and computer scheme Forward scheme handler of trash and computer to inode/directory's handler. Log: support trash and computer scheme Issue: https://github.com/linuxdeepin/developer-center/issues/8266 --- dde-open/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dde-open/main.go b/dde-open/main.go index 5514506..b54f99f 100644 --- a/dde-open/main.go +++ b/dde-open/main.go @@ -204,6 +204,12 @@ func openFile(filename string) error { func openScheme(scheme, url string) error { logger.Debugf("openScheme: %q, %q", scheme, url) appInfo := gio.AppInfoGetDefaultForUriScheme(scheme) + if appInfo == nil && (scheme == "trash" || scheme == "computer") { + // As file manager do not register scheme for trash and computer, which are the private protocols + // supported by gio. To keep compatibility, we forward these protocols to inode/directory's handler. + // By default, it will be the default file manager like dde-file-manager. + appInfo = gio.AppInfoGetDefaultForType("inode/directory", true) + } if appInfo == nil { return errors.New("failed to get appInfo") }