Просмотр исходного кода

Try to be more conformant with XDG standards

First attempt to base saturnin paths on XDG paths.
Alois Mahdal 7 лет назад
Родитель
Сommit
01607f9683
2 измененных файлов: 13 добавлений и 5 удалений
  1. 7
    2
      mkit.ini
  2. 6
    3
      src/bin/app.skel

+ 7
- 2
mkit.ini Просмотреть файл

@@ -20,6 +20,9 @@
20 20
 
21 21
 [ENV]
22 22
     PREFIX = /usr/local
23
+    XDG_DATA_HOME = $HOME/.local/share
24
+    XDG_CACHE_HOME = $HOME/.cache
25
+    XDG_CONFIG_HOME = $HOME/.config
23 26
 
24 27
 [roots]
25 28
     bin     = [ENV:PREFIX]/bin
@@ -30,11 +33,13 @@
30 33
     etc_bc  = /etc/bash_completion.d
31 34
 
32 35
 [tokens]
33
-    __SATURNIN_CACHE_HOME__     = $HOME/.cache/saturnin-demo
34
-    __SATURNIN_CONFIG_USER__    = $HOME/.saturnin-demo
36
+    __SATURNIN_DATA_HOME__      = [ENV:XDG_DATA_HOME]/saturnin-demo
37
+    __SATURNIN_CACHE_HOME__     = [ENV:XDG_CACHE_HOME]/saturnin-demo
38
+    __SATURNIN_CONFIG_HOME__    = [ENV:XDG_CONFIG_HOME]/saturnin-demo
35 39
     __SATURNIN_CONFIG_LOCAL__   = [roots:etc]
36 40
     __SATURNIN_LIBEXEC__        = [roots:libexec]
37 41
     __SATURNIN_SHARE__          = [roots:share]
42
+    __SATURNIN_SHELLFU_DIR__    = [roots:share]/shellfu
38 43
 
39 44
 [modes]
40 45
     bin     = 755

+ 6
- 3
src/bin/app.skel Просмотреть файл

@@ -13,8 +13,11 @@
13 13
     SATURNIN_APP_VERSION="__MKIT_PROJ_VERSION__"
14 14
     SATURNIN_APP_GIT_HASH="__MKIT_PROJ_GIT_LASTHASH__"
15 15
     SATURNIN_CACHE_HOME="__SATURNIN_CACHE_HOME__"
16
+    SATURNIN_CONFIG_HOME="__SATURNIN_CONFIG_HOME__"
17
+    SATURNIN_DATA_HOME="__SATURNIN_DATA_HOME__"
16 18
     SATURNIN_LIBEXEC="__SATURNIN_LIBEXEC__"
17 19
     SATURNIN_LIBEXEC_PREFIX="__MKIT_PROJ_PKGNAME__-"
20
+    SHELLFU_PATH="__SATURNIN_SHELLFU_DIR__"
18 21
     PRETTY_USAGE="subcommand"
19 22
 }
20 23
 
@@ -22,8 +25,8 @@ shellfu import saturnin
22 25
 
23 26
 SATURNIN_CONF_PATH="$(
24 27
     saturnin__conf_mkpath \
25
-        __SATURNIN_CONFIG_USER__/ini.d \
26
-        __SATURNIN_CONFIG_USER__ \
28
+        __SATURNIN_CONFIG_HOME__/ini.d \
29
+        __SATURNIN_CONFIG_HOME__ \
27 30
         __SATURNIN_CONFIG_LOCAL__ \
28 31
         __SATURNIN_SHARE__/ini.d
29 32
 )"
@@ -33,6 +36,6 @@ SATURNIN_CONF_PATH="$(
33 36
 #
34 37
 
35 38
 export SATURNIN_CONF_PATH SHELLFU_PATH PRETTY_USAGE \
36
-       SATURNIN_CACHE_HOME
39
+       SATURNIN_CACHE_HOME SATURNIN_CONFIG_HOME SATURNIN_DATA_HOME
37 40
 
38 41
 saturnin__main "$@"