Change default database location and name

This commit is contained in:
Daniel Schulte 2020-11-26 19:38:00 +01:00
parent b4c4fb75c0
commit 9e50c06ceb
2 changed files with 3 additions and 2 deletions

View File

@ -441,11 +441,11 @@ bool save_json(const std::string &filename, const json &data) {
} }
} }
std::string database_filename = "yttool.sqlite";
int main() int main()
{ {
user_home = std::string(std::getenv("HOME")); user_home = std::string(std::getenv("HOME"));
std::string database_filename = user_home + "/.local/share/yttui.db";
std::vector<std::string> config_locations{user_home + "/.config/", "./"}; std::vector<std::string> config_locations{user_home + "/.config/", "./"};
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
@ -473,7 +473,7 @@ int main()
} }
} }
if(config.count("database") && config["database"].is_string()) { if(config.count("database") && config["database"].is_string()) {
database_filename = config["database"]; database_filename = replace(config["database"], "$HOME", user_home);
} }
if(config.count("watchCommand") && config["watchCommand"].is_array()) { if(config.count("watchCommand") && config["watchCommand"].is_array()) {
watch_command.clear(); watch_command.clear();

View File

@ -3,5 +3,6 @@
"extraHeaders": [ "extraHeaders": [
{"key": "x-extra", "value": "heder"} {"key": "x-extra", "value": "heder"}
], ],
"database": "$HOME/yttui.db",
"watchCommand": ["xdg-open", "https://youtube.com/watch?v={{vid}}"] "watchCommand": ["xdg-open", "https://youtube.com/watch?v={{vid}}"]
} }