模块安装window部分
This commit is contained in:
@@ -442,6 +442,38 @@ void fastweb::install_module_linux(fastweb::module_info info)
|
||||
|
||||
void fastweb::install_module_windows(fastweb::module_info info)
|
||||
{
|
||||
|
||||
std::cout<<"正在安装 `"<<info.name_en<<"` 库"<<std::endl;
|
||||
network::http::client_plus client;
|
||||
if(client.get(info.download_win64) == false)
|
||||
{
|
||||
std::cerr<<"下载模块压缩包失败: "<<info.download_win64<<", "<<client.last_error()<<std::endl;
|
||||
return;
|
||||
}
|
||||
if(client.status() != 200)
|
||||
{
|
||||
std::cerr<<"下载模块压缩包失败: "<<info.download_win64<<", status: "<<client.status()<<std::endl;
|
||||
return;
|
||||
}
|
||||
std::string zip_filepath = ylib::file::temp_filepath()+".zip";
|
||||
ylib:file::write(zip_filepath,client.response());
|
||||
|
||||
|
||||
std::string new_module_dirpath = m_ini.read("scripts","module_dir")+"/.install/"+info.id;
|
||||
ylib::file::create_dir(new_module_dirpath,true);
|
||||
std::string cmd = "unzip -o -q "+zip_filepath+" -d "+new_module_dirpath;
|
||||
|
||||
auto [code,err] = execute_command(cmd);
|
||||
if(code != 0)
|
||||
{
|
||||
std::cerr<<"安装失败:"<<std::endl;
|
||||
std::cerr<<cmd<<std::endl;
|
||||
std::cerr<<err<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr<<"安装成功"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
bool fastweb::parse_config(const std::string &ini_filepath)
|
||||
|
||||
Reference in New Issue
Block a user