diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-30 20:22:56 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-30 20:23:00 +0200 |
commit | fa1611f96ba4e56f4d8cc362a192bdd29351f51f (patch) | |
tree | 0eafea55a6d9ef55c9ca018e8821af8c8da60de2 /src | |
parent | 664835fcee5f0dc1fa5aba63c845c4561628a20f (diff) |
fix readlink in download_async_gui
Diffstat (limited to 'src')
-rw-r--r-- | src/DownloadUtils.cpp | 11 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp index 9834390..774fba9 100644 --- a/src/DownloadUtils.cpp +++ b/src/DownloadUtils.cpp @@ -214,11 +214,12 @@ namespace QuickMedia { } bool download_async_gui(const std::string &url, const std::string &file_manager_start_dir, bool use_youtube_dl, bool no_video) { - // TODO: Fix this not working when installed to /usr/bin/quickmedia for some reason - //char quickmedia_path[PATH_MAX]; - //if(readlink("/proc/self/exe", quickmedia_path, sizeof(quickmedia_path)) == -1) - // strcpy(quickmedia_path, "quickmedia"); - const char *quickmedia_path = "quickmedia"; + char quickmedia_path[PATH_MAX]; + ssize_t bytes_written = readlink("/proc/self/exe", quickmedia_path, sizeof(quickmedia_path)); + if(bytes_written == -1 || bytes_written == sizeof(quickmedia_path)) + strcpy(quickmedia_path, "quickmedia"); + else + quickmedia_path[bytes_written] = '\0'; std::vector<const char*> args = { quickmedia_path, "download", "-u", url.c_str(), "--dir", file_manager_start_dir.c_str() }; if(use_youtube_dl) args.push_back("--youtube-dl"); diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 595ae7b..5bbad84 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1889,9 +1889,7 @@ namespace QuickMedia { BodyItem *selected_item = tabs[selected_tab].body->get_selected(); if(selected_item && tabs[selected_tab].page->is_trackable()) { TrackablePage *trackable_page = dynamic_cast<TrackablePage*>(tabs[selected_tab].page.get()); - run_task_with_loading_screen([trackable_page, selected_item](){ - return trackable_page->track(selected_item->get_title()) == TrackResult::OK; - }); + trackable_page->track(selected_item->get_title()); } } else if(event.key.code == sf::Keyboard::C && event.key.control) { BodyItem *selected_item = tabs[selected_tab].body->get_selected(); |