| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import configparser |
| 4 |
import os |
| 5 |
import sys |
| 6 |
from inspect import isfunction |
| 7 |
from os import listdir |
| 8 |
from os.path import isfile |
| 9 |
from os.path import join |
| 10 |
|
| 11 |
from xdg import BaseDirectory |
| 12 |
|
| 13 |
# Get configuration directory |
| 14 |
if len(sys.argv) > 1: |
| 15 |
config_path = sys.argv[1] |
| 16 |
elif os.geteuid() == 0: |
| 17 |
# Save settings system wide |
| 18 |
config_path = "/etc/fenrir.conf" |
| 19 |
else: |
| 20 |
# Use local settings |
| 21 |
config_path = BaseDirectory.xdg_data_home + "/fenrir" |
| 22 |
if not os.path.exists(config_path): |
| 23 |
os.makedirs(config_path) |
| 24 |
config_path = config_path + "/fenrir.conf" |