| 25 | |
| 26 | |
| 27 | fs::path GUI::gui_bottom::file_path() |
| 28 | { |
| 29 | if(!printed_path.empty()) |
| 30 | { |
| 31 | if(printed_path.extension().string() != "NA") |
| 32 | { |
| 33 | if(fs::exists(printed_path)) |
| 34 | return printed_path; |
| 35 | } |
| 36 | if(!merger_path.empty()) |
| 37 | { |
| 38 | printed_path.replace_extension(merger_path.extension()); |
| 39 | if(fs::exists(printed_path)) |
| 40 | return printed_path; |
| 41 | if(!download_path.empty()) |
| 42 | { |
| 43 | printed_path.replace_extension(download_path.extension()); |
| 44 | if(fs::exists(printed_path)) |
| 45 | return printed_path; |
| 46 | } |
| 47 | if(vidinfo_contains("ext")) |
| 48 | { |
| 49 | std::string ext {vidinfo["ext"]}; |
| 50 | printed_path.replace_extension(ext); |
| 51 | if(fs::exists(printed_path)) |
| 52 | return printed_path; |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | if(!merger_path.empty() && fs::exists(merger_path)) |
| 58 | return merger_path; |
| 59 | if(!download_path.empty() && fs::exists(download_path)) |
| 60 | return download_path; |
| 61 | |
| 62 | fs::path file; |
| 63 | if(vidinfo_contains("filename")) |
| 64 | file = fs::u8path(vidinfo["filename"].get<std::string>()); |
| 65 | |
| 66 | if(!file.empty()) |
| 67 | { |
| 68 | file = outpath / file; |
| 69 | if(!fs::exists(file)) |
| 70 | { |
| 71 | if(cbargs && argset.find("-f ") != -1) |
| 72 | { |
| 73 | auto pos {argset.find("-f ")}; |
| 74 | if(pos != -1) |
| 75 | { |
| 76 | pos += 1; |
| 77 | while(pos < argset.size() && isspace(argset[++pos])); |
| 78 | std::string num; |
| 79 | while(pos < argset.size()) |
| 80 | { |
| 81 | char c {argset[pos++]}; |
| 82 | if(isdigit(c)) |
| 83 | num += c; |
| 84 | else break; |