MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / ValidateDownloadSelection

Function ValidateDownloadSelection

Source/Tools/FEXRootFSFetcher/Main.cpp:775–800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775bool ValidateDownloadSelection(const WebFileFetcher::FileTargets& Target) {
776 fextl::string Text = fextl::fmt::format("Selected Rootfs: {}\n", Target.DistroName);
777 Text += fmt::format("\tURL: {}\n", Target.URL);
778 Text += fmt::format("Are you sure that you want to download this image");
779
780 if (AskForConfirmation(Text)) {
781 fextl::string RootFS = FEXCore::Config::GetDataDirectory() + "RootFS/";
782 std::error_code ec {};
783 if (!std::filesystem::exists(RootFS, ec)) {
784 // Doesn't exist, create the the folder as a user convenience
785 if (!std::filesystem::create_directories(RootFS, ec)) {
786 // Well I guess we failed
787 Text = fmt::format("Couldn't create {} path for storing RootFS", RootFS);
788 ExecWithInfo(Text);
789 return false;
790 }
791 }
792
793 if (!WebFileFetcher::DownloadToPathWithZenityProgress(Target.URL, RootFS)) {
794 return false;
795 }
796
797 return true;
798 }
799 return false;
800}
801} // namespace Zenity
802
803namespace TTY {

Callers 1

mainFunction · 0.85

Calls 7

formatFunction · 0.85
AskForConfirmationFunction · 0.85
GetDataDirectoryFunction · 0.85
ExecWithInfoFunction · 0.85
printFunction · 0.85
DownloadToPathFunction · 0.85

Tested by

no test coverage detected