Files
mob/src/tasks/explorerpp.cpp
T

74 lines
1.2 KiB
C++
Raw Normal View History

2020-05-06 14:14:32 -04:00
#include "pch.h"
#include "tasks.h"
2020-11-18 00:42:43 -05:00
namespace mob::tasks
2020-05-06 14:14:32 -04:00
{
explorerpp::explorerpp()
: basic_task("explorerpp", "explorer++")
{
}
2020-05-17 14:14:29 -04:00
std::string explorerpp::version()
2020-05-07 11:08:33 -04:00
{
2020-05-17 15:50:15 -04:00
return conf::version_by_name("explorerpp");
2020-05-07 11:08:33 -04:00
}
bool explorerpp::prebuilt()
{
return false;
}
2020-05-06 14:14:32 -04:00
fs::path explorerpp::source_path()
{
2020-11-21 00:08:45 -05:00
return conf().paths().build() / "explorer++";
2020-05-06 14:14:32 -04:00
}
void explorerpp::do_clean(clean c)
{
instrument<times::clean>([&]
{
if (is_set(c, clean::redownload))
run_tool(downloader(source_url(), downloader::clean));
2020-05-25 01:43:16 -04:00
if (is_set(c, clean::reextract))
{
cx().trace(context::reextract, "deleting {}", source_path());
op::delete_directory(cx(), source_path(), op::optional);
return;
}
});
}
2020-05-06 14:14:32 -04:00
void explorerpp::do_fetch()
{
2020-05-21 04:45:49 -04:00
const auto file = instrument<times::fetch>([&]
2020-05-20 05:41:19 -04:00
{
return run_tool(downloader(source_url()));
});
2020-05-06 14:14:32 -04:00
2020-05-21 04:45:49 -04:00
instrument<times::extract>([&]
2020-05-20 05:41:19 -04:00
{
run_tool(extractor()
.file(file)
.output(source_path()));
});
2020-05-06 14:14:32 -04:00
2020-05-21 04:45:49 -04:00
instrument<times::install>([&]
2020-05-20 05:41:19 -04:00
{
op::copy_glob_to_dir_if_better(cx(),
source_path() / "*",
2020-11-21 00:08:45 -05:00
conf().paths().install_bin() / "explorer++",
2020-05-20 05:41:19 -04:00
op::copy_files);
});
2020-05-06 14:14:32 -04:00
}
url explorerpp::source_url()
{
return
"https://explorerplusplus.com/software/"
2020-05-07 11:08:33 -04:00
"explorer++_" + version() + "_x64.zip";
2020-05-06 14:14:32 -04:00
}
} // namespace