From aa0d78815004ae6b0c4a42b0e024f5c4ef555ae2 Mon Sep 17 00:00:00 2001 From: dacctal Date: Sun, 24 May 2026 10:23:38 +0000 Subject: c rewrite --- src/create_pkg.cc | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 src/create_pkg.cc (limited to 'src/create_pkg.cc') diff --git a/src/create_pkg.cc b/src/create_pkg.cc deleted file mode 100644 index 4208208..0000000 --- a/src/create_pkg.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include - -#include "create_pkg.hh" -#include "lua_state.hh" -#include "name_from_url.hh" -#include "vars.hh" - -Pkg create_pkg(std::string arg, const char* target) { - Pkg pkg; - pkg.target = target; - pkg.ver = "HEAD"; - pkg.is_local = false; - bool is_in_repos = false; - - init_lua_state(); - cache_repos(); - for (auto repo : cached_repos) { - if (arg == repo.first) { is_in_repos = true; } - } - - if (arg.rfind("http", 0) == 0) { - pkg.url = arg; - pkg.name = name_from_url(arg); - } else if (arg == ".") { - pkg.url = ""; - pkg.src = std::filesystem::current_path().string(); - pkg.name = name_from_url(std::filesystem::current_path().string()); - pkg.is_local = true; - } else if (is_in_repos) { - pkg.url = cached_repos[arg].source.value; - pkg.name = arg; - } else { - std::cout << print_error << "'" << arg << "'" << " is not a valid package" << std::endl; - exit(1); - } - - cache_install_directories(); - if (!pkg.is_local) { - pkg.src = install_directories["src"] + "/" + pkg.name + "/" + pkg.ver; - } - - return pkg; -} -- cgit v1.2.3