From 8f8a49791a169ba0ba7b1f78b8c1507fd7736f8a Mon Sep 17 00:00:00 2001 From: lzwdgc Date: Tue, 13 Feb 2024 21:48:12 +0300 Subject: [PATCH] Initial mod activator. --- src/aim1_mod_activator/mod_activator.cpp | 42 ++++++++++++++++++++++++ sw.cpp | 3 ++ 2 files changed, 45 insertions(+) create mode 100644 src/aim1_mod_activator/mod_activator.cpp diff --git a/src/aim1_mod_activator/mod_activator.cpp b/src/aim1_mod_activator/mod_activator.cpp new file mode 100644 index 0000000..4d9fba7 --- /dev/null +++ b/src/aim1_mod_activator/mod_activator.cpp @@ -0,0 +1,42 @@ +/* + * AIM mod_activator + * Copyright (C) 2024 lzwdgc + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include + +void activate(auto &&fn) { + // files will get new timestamp automatically + // our unpack_file() does not preserve timestamps + unpack_file(fn, fs::current_path()); +} + +int main(int argc, char *argv[]) +{ + cl::opt p(cl::Positional, cl::desc(""), cl::value_desc("file"), cl::Required); + + cl::ParseCommandLineOptions(argc, argv); + + if (fs::is_regular_file(p)) { + activate(p); + } else { + throw std::runtime_error("Bad fs object"); + } + + return 0; +} diff --git a/sw.cpp b/sw.cpp index 005dbab..d715f79 100644 --- a/sw.cpp +++ b/sw.cpp @@ -76,6 +76,9 @@ void build(Solution &s) ; } + auto &aim1_mod_activator = add_exe_with_common("aim1_mod_activator"); + aim1_mod_activator += "pub.egorpugin.primitives.pack"_dep; + auto &aim1_mod_maker = add_exe_with_common("aim1_mod_maker"); // actually a library aim1_mod_maker.Public += "pub.egorpugin.primitives.command"_dep;