~aleteoryx/tclircc

ref: 76f60368ef896dcfd80f9bd668171ece03820450 tclircc/src/persist.tcl -rw-r--r-- 524 bytes
76f60368Aleteoryx boot! 12 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
switch -- [set tcl_platform(platform)] {
  "windows" {
    set data_dir [file join [set env(APPDATA)] tclircc]
  }
  "unix" {
    if [info exists env(XDG_CONFIG_HOME)] {
      set data_dir [file join [set env(XDG_CONFIG_HOME)] tclircc]
    } elseif [info exists env(HOME)] {
      set data_dir [file join [set env(HOME)] .config tclircc]
    } else {
      return -code error {Missing $HOME or $XDG_CONFIG_HOME, can't store config!}
    }
  }
  default {
    return -code error {Unknown platform, can't store config.}
  }
}