diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-02-02 00:54:47 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-02-02 00:54:47 +0100 |
commit | 5195c84ee9758b29cf1db696e06140e9a9a5284d (patch) | |
tree | 3490984a87b1752907040879f61d738038ce2405 /src/QuickMedia.cpp | |
parent | cf83bf2fea7efd0d7239dc021741fb88eb76ea8b (diff) |
Fix crash when launching for first time, fix for new mpv version
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r-- | src/QuickMedia.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 349cc28..0c17a52 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -374,8 +374,13 @@ namespace QuickMedia { // TOOD: Make generic, instead of checking for plugin if(current_plugin->name == "manganelo") { + Path content_storage_dir = get_storage_dir().join("manga"); + if(create_directory_recursive(content_storage_dir) != 0) { + show_notification("Storage", "Failed to create directory: " + content_storage_dir.data, Urgency::CRITICAL); + exit(1); + } // TODO: Make asynchronous - for_files_in_dir(get_storage_dir().join("manga"), [&history_body](const std::filesystem::path &filepath) { + for_files_in_dir(content_storage_dir, [&history_body](const std::filesystem::path &filepath) { Path fullpath(filepath.c_str()); Json::Value body; if(!read_file_as_json(fullpath, body)) { @@ -419,10 +424,6 @@ namespace QuickMedia { } Path content_storage_dir = get_storage_dir().join("manga"); - if(create_directory_recursive(content_storage_dir) != 0) { - show_notification("Storage", "Failed to create directory: " + content_storage_dir.data, Urgency::CRITICAL); - return false; - } std::string manga_id; if(!manga_extract_id_from_url(content_url, manga_id)) @@ -1877,4 +1878,4 @@ namespace QuickMedia { // so you dont have to retype a post that was in the middle of being posted when returning. search_bar->clear(); } -}
\ No newline at end of file +} |