diff options
Diffstat (limited to 'pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch')
-rw-r--r-- | pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch | 254 |
1 files changed, 0 insertions, 254 deletions
diff --git a/pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch b/pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch deleted file mode 100644 index c0a8a02558c5..000000000000 --- a/pkgs/desktops/deepin/go-package/dde-daemon/0003-search-in-XDG-directories.patch +++ /dev/null @@ -1,254 +0,0 @@ -From a0667a7e82b3176e64122f4d68c43de4fa350780 Mon Sep 17 00:00:00 2001 -From: rewine <luhongxu@deepin.org> -Date: Tue, 18 Apr 2023 17:04:36 +0800 -Subject: [PATCH 3/4] search-in-XDG-directories - ---- - accounts/manager.go | 5 ++++- - accounts/user.go | 8 +++++++- - appearance/fsnotify.go | 21 +++++++++++++++++---- - appearance/ifc.go | 3 ++- - apps/utils.go | 3 ++- - gesture/config.go | 4 ++-- - keybinding/shortcuts/system_shortcut.go | 4 +++- - mime/app_info.go | 7 ++++++- - system/gesture/config.go | 4 +++- - 9 files changed, 46 insertions(+), 13 deletions(-) - -diff --git a/accounts/manager.go b/accounts/manager.go -index 22c26ce7..009d9dd9 100644 ---- a/accounts/manager.go -+++ b/accounts/manager.go -@@ -15,6 +15,7 @@ import ( - "sync" - "syscall" - -+ "github.com/adrg/xdg" - dbus "github.com/godbus/dbus" - "github.com/linuxdeepin/dde-daemon/accounts/users" - "github.com/linuxdeepin/dde-daemon/common/sessionmsg" -@@ -35,8 +36,10 @@ const ( - actConfigFile = actConfigDir + "/accounts.ini" - actConfigGroupGroup = "Accounts" - actConfigKeyGuest = "AllowGuest" -+) - -- interfacesFile = "/usr/share/dde-daemon/accounts/dbus-udcp.json" -+var ( -+ interfacesFile, _ = xdg.SearchDataFile("dde-daemon/accounts/dbus-udcp.json") - ) - - type InterfaceConfig struct { -diff --git a/accounts/user.go b/accounts/user.go -index 900033c6..f8827fb2 100644 ---- a/accounts/user.go -+++ b/accounts/user.go -@@ -15,6 +15,7 @@ import ( - "strings" - "sync" - -+ "github.com/adrg/xdg" - dbus "github.com/godbus/dbus" - "github.com/linuxdeepin/dde-daemon/accounts/users" - authenticate "github.com/linuxdeepin/go-dbus-factory/com.deepin.daemon.authenticate" -@@ -649,7 +650,12 @@ func getUserSession(homeDir string) string { - } - - func getSessionList() []string { -- fileInfoList, err := ioutil.ReadDir("/usr/share/xsessions") -+ xsessionPath, err := xdg.SearchDataFile("xsessions") -+ if err != nil { -+ return nil; -+ } -+ -+ fileInfoList, err := ioutil.ReadDir(xsessionPath) - if err != nil { - return nil - } -diff --git a/appearance/fsnotify.go b/appearance/fsnotify.go -index a409d0ba..ff674600 100644 ---- a/appearance/fsnotify.go -+++ b/appearance/fsnotify.go -@@ -5,12 +5,15 @@ - package appearance - - import ( -+ "errors" -+ "io/fs" - "os" - "path" - "path/filepath" - "strings" - "time" - -+ "github.com/adrg/xdg" - "github.com/fsnotify/fsnotify" - "github.com/linuxdeepin/dde-daemon/appearance/background" - "github.com/linuxdeepin/dde-daemon/appearance/subthemes" -@@ -100,9 +103,14 @@ func (m *Manager) watchGtkDirs() { - gtkDirs = []string{ - path.Join(home, ".local/share/themes"), - path.Join(home, ".themes"), -- "/usr/local/share/themes", -- "/usr/share/themes", - } -+ for _, dataPath := range xdg.DataDirs { -+ gtkPath := filepath.Join(dataPath, "themes"); -+ if _, err := os.Stat(gtkPath); err != nil && errors.Is(err, fs.ErrNotExist) { -+ continue -+ } -+ gtkDirs = append(gtkDirs, gtkPath); -+ } - - m.watchDirs(gtkDirs) - } -@@ -112,9 +120,14 @@ func (m *Manager) watchIconDirs() { - iconDirs = []string{ - path.Join(home, ".local/share/icons"), - path.Join(home, ".icons"), -- "/usr/local/share/icons", -- "/usr/share/icons", - } -+ for _, dataPath := range xdg.DataDirs { -+ iconPath := filepath.Join(dataPath, "icons"); -+ if _, err := os.Stat(iconPath); err != nil && errors.Is(err, fs.ErrNotExist) { -+ continue -+ } -+ iconDirs = append(iconDirs, iconPath); -+ } - - m.watchDirs(iconDirs) - } -diff --git a/appearance/ifc.go b/appearance/ifc.go -index f0bf32a3..6d60ffe4 100644 ---- a/appearance/ifc.go -+++ b/appearance/ifc.go -@@ -10,6 +10,7 @@ import ( - "strconv" - "strings" - -+ "github.com/adrg/xdg" - "github.com/godbus/dbus" - "github.com/linuxdeepin/dde-daemon/appearance/fonts" - "github.com/linuxdeepin/dde-daemon/appearance/subthemes" -@@ -265,7 +266,7 @@ func (m *Manager) thumbnail(ty, name string) (string, error) { - case TypeGtkTheme: - fName, ok := gtkThumbnailMap[name] - if ok { -- return filepath.Join("/usr/share/dde-daemon/appearance", fName+".svg"), nil -+ return xdg.SearchDataFile(filepath.Join("dde-daemon/appearance", fName+".svg")) - } - return subthemes.GetGtkThumbnail(name) - case TypeIconTheme: -diff --git a/apps/utils.go b/apps/utils.go -index 8863d6c2..dd6f8e16 100644 ---- a/apps/utils.go -+++ b/apps/utils.go -@@ -11,6 +11,7 @@ import ( - "strconv" - "strings" - "syscall" -+ "github.com/adrg/xdg" - ) - - func intSliceContains(slice []int, a int) bool { -@@ -96,7 +97,7 @@ func removeDesktopExt(name string) string { - } - - func getSystemDataDirs() []string { -- return []string{"/usr/share", "/usr/local/share"} -+ return xdg.DataDirs - } - - // get user home -diff --git a/gesture/config.go b/gesture/config.go -index bfbd4db7..4ce9d641 100644 ---- a/gesture/config.go -+++ b/gesture/config.go -@@ -10,6 +10,7 @@ import ( - "io/ioutil" - "path/filepath" - -+ "github.com/adrg/xdg" - "github.com/linuxdeepin/go-lib/xdg/basedir" - ) - -@@ -21,11 +22,10 @@ const ( - - var ( - configUserPath = filepath.Join(basedir.GetUserConfigDir(), "deepin/dde-daemon/gesture.json") -+ configSystemPath, _ = xdg.SearchDataFile("dde-daemon/gesture.json") - ) - - const ( -- configSystemPath = "/usr/share/dde-daemon/gesture.json" -- - gestureSchemaId = "com.deepin.dde.gesture" - gsKeyTouchPadEnabled = "touch-pad-enabled" - gsKeyTouchScreenEnabled = "touch-screen-enabled" -diff --git a/keybinding/shortcuts/system_shortcut.go b/keybinding/shortcuts/system_shortcut.go -index eaec22b5..95e1b222 100644 ---- a/keybinding/shortcuts/system_shortcut.go -+++ b/keybinding/shortcuts/system_shortcut.go -@@ -10,6 +10,7 @@ import ( - "path" - "sync" - -+ "github.com/adrg/xdg" - dutils "github.com/linuxdeepin/go-lib/utils" - ) - -@@ -152,5 +153,6 @@ func getSystemActionsFile() string { - return file - } - -- return "" -+ filepath, _ := xdg.SearchDataFile(systemActionsFile) -+ return filepath; - } -diff --git a/mime/app_info.go b/mime/app_info.go -index 63fcdcc0..18436164 100644 ---- a/mime/app_info.go -+++ b/mime/app_info.go -@@ -9,6 +9,7 @@ import ( - "os" - "path" - -+ "github.com/adrg/xdg" - "github.com/linuxdeepin/go-lib/appinfo/desktopappinfo" - "github.com/linuxdeepin/go-lib/mime" - dutils "github.com/linuxdeepin/go-lib/utils" -@@ -162,5 +163,9 @@ func findFilePath(file string) string { - return data - } - -- return path.Join("/usr/share", file) -+ filepath, err := xdg.SearchDataFile(file) -+ if err != nil { -+ return path.Join("/usr/share", file) -+ } -+ return filepath; - } -diff --git a/system/gesture/config.go b/system/gesture/config.go -index d4aebaac..f3fc92c3 100644 ---- a/system/gesture/config.go -+++ b/system/gesture/config.go -@@ -8,6 +8,7 @@ import ( - "encoding/json" - "io/ioutil" - -+ "github.com/adrg/xdg" - "github.com/linuxdeepin/go-lib/utils" - ) - -@@ -35,5 +36,6 @@ func getConfigPath() string { - if utils.IsFileExist(filename) { - return filename - } -- return "/usr/share/" + suffix -+ filepath, _ := xdg.SearchDataFile(suffix) -+ return filepath; - } --- -2.38.1 - |