package require sqlite3
package require logger
set log [logger::init tclircc::db]
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.}
}
}
file mkdir $data_dir
proc path_to_core {} {
global data_dir
return [file join $data_dir core.db]
}