File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -106,17 +106,27 @@ func ClearCahceFiles() {
106106
107107func getDictDir () string {
108108 dbDir := os .Getenv ("YDICT_DB" )
109+ xdgCacheDir := os .Getenv ("XDG_CACHE_HOME" )
109110 if dbDir == "" {
110- dbDir = filepath .Join (os .Getenv ("HOME" ), ".ydict" )
111+ if xdgCacheDir != "" {
112+ dbDir = filepath .Join (xdgCacheDir , "ydict" )
113+ } else {
114+ dbDir = filepath .Join (os .Getenv ("HOME" ), ".cache/ydict" )
115+ }
111116 }
112117
113118 return dbDir
114119}
115120
116121func getDictDBDir () string {
117122 dbDir := os .Getenv ("YDICT_DB" )
123+ xdgCacheDir := os .Getenv ("XDG_CACHE_HOME" )
118124 if dbDir == "" {
119- dbDir = filepath .Join (os .Getenv ("HOME" ), ".ydict" )
125+ if xdgCacheDir != "" {
126+ dbDir = filepath .Join (xdgCacheDir , "ydict" )
127+ } else {
128+ dbDir = filepath .Join (os .Getenv ("HOME" ), ".cache/ydict" )
129+ }
120130 }
121131
122132 ydictDir := filepath .Join (dbDir , "db" )
You can’t perform that action at this time.
0 commit comments