From 5195c84ee9758b29cf1db696e06140e9a9a5284d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 2 Feb 2020 00:54:47 +0100 Subject: Fix crash when launching for first time, fix for new mpv version --- src/QuickMedia.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/QuickMedia.cpp') 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 +} -- cgit v1.2.3