46 return 1; |
46 return 1; |
47 end |
47 end |
48 |
48 |
49 local accounts = { default = {} }; |
49 local accounts = { default = {} }; |
50 local current_account; |
50 local current_account; |
51 for line in io.lines(os.getenv("HOME").."/.clix") do |
51 |
|
52 local config_path = (os.getenv("XDG_CONFIG_HOME") or (os.getenv("HOME").."/.config"); |
|
53 local config_file, err = io.open(config_path.."/.clixrc") or io.open(config_path.."/.clix"); |
|
54 |
|
55 if not config_file then |
|
56 print("Unable to open config file... looked for "..config_path.."/.clixrc"); |
|
57 if err then print(err); end |
|
58 os.exit(1); |
|
59 end |
|
60 |
|
61 for line in config_file:lines() do |
52 line = line:match("^%s*(.-)%s*$"); |
62 line = line:match("^%s*(.-)%s*$"); |
53 if line:match("^%[") then |
63 if line:match("^%[") then |
54 current_account = line:match("^%[(.-)%]"); |
64 current_account = line:match("^%[(.-)%]"); |
55 accounts[current_account] = {}; |
65 accounts[current_account] = {}; |
56 if not current_account then -- This is the first defined account |
66 if not current_account then -- This is the first defined account |