summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/DankMaterialShell/core/internal/utils/paths.go
diff options
context:
space:
mode:
authorAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
committerAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
commit70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch)
treeab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-hyprland-theme/theme-data/DankMaterialShell/core/internal/utils/paths.go
parent5d94c0a7d44a2255b81815a52a7056a94a39842d (diff)
downloadRaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz
RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-hyprland-theme/theme-data/DankMaterialShell/core/internal/utils/paths.go')
-rw-r--r--raveos-hyprland-theme/theme-data/DankMaterialShell/core/internal/utils/paths.go70
1 files changed, 70 insertions, 0 deletions
diff --git a/raveos-hyprland-theme/theme-data/DankMaterialShell/core/internal/utils/paths.go b/raveos-hyprland-theme/theme-data/DankMaterialShell/core/internal/utils/paths.go
new file mode 100644
index 0000000..053097e
--- /dev/null
+++ b/raveos-hyprland-theme/theme-data/DankMaterialShell/core/internal/utils/paths.go
@@ -0,0 +1,70 @@
+package utils
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+func XDGStateHome() string {
+ if dir := os.Getenv("XDG_STATE_HOME"); dir != "" {
+ return dir
+ }
+ home, _ := os.UserHomeDir()
+ return filepath.Join(home, ".local", "state")
+}
+
+func XDGDataHome() string {
+ if dir := os.Getenv("XDG_DATA_HOME"); dir != "" {
+ return dir
+ }
+ home, _ := os.UserHomeDir()
+ return filepath.Join(home, ".local", "share")
+}
+
+func XDGCacheHome() string {
+ if dir, err := os.UserCacheDir(); err == nil {
+ return dir
+ }
+ home, _ := os.UserHomeDir()
+ return filepath.Join(home, ".cache")
+}
+
+func XDGConfigHome() string {
+ if dir, err := os.UserConfigDir(); err == nil {
+ return dir
+ }
+ home, _ := os.UserHomeDir()
+ return filepath.Join(home, ".config")
+}
+
+func EmacsConfigDir() string {
+ home, _ := os.UserHomeDir()
+
+ emacsD := filepath.Join(home, ".emacs.d")
+ if info, err := os.Stat(emacsD); err == nil && info.IsDir() {
+ return emacsD
+ }
+
+ xdgEmacs := filepath.Join(XDGConfigHome(), "emacs")
+ if info, err := os.Stat(xdgEmacs); err == nil && info.IsDir() {
+ return xdgEmacs
+ }
+
+ return ""
+}
+
+func ExpandPath(path string) (string, error) {
+ expanded := os.ExpandEnv(path)
+ expanded = filepath.Clean(expanded)
+
+ if strings.HasPrefix(expanded, "~") {
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return "", err
+ }
+ expanded = filepath.Join(home, expanded[1:])
+ }
+
+ return expanded, nil
+}