module Unix = UnixLabels

let dotdir = Filename.concat (Sys.getenv "HOME") ".cardflasher"

let config_file = Filename.concat dotdir "config"
let data_file = Filename.concat dotdir "data"

let ensure_conf_exists () =
    if not (Sys.file_exists dotdir) then
        Unix.mkdir dotdir ~perm:0o755;

    if not (Sys.file_exists config_file) then
        close_out(open_out config_file);

    if not (Sys.file_exists data_file) then
        close_out(open_out data_file)
            
let config_filename () = ensure_conf_exists (); config_file
let data_filename () = ensure_conf_exists (); data_file

