mirror of
https://github.com/yawaflua/SpCloudCore.git
synced 2025-12-09 20:19:35 +02:00
Problem with unzip
This commit is contained in:
@@ -15,7 +15,8 @@ private:
|
|||||||
FileProcessingService file_processing;
|
FileProcessingService file_processing;
|
||||||
|
|
||||||
//std::string publish_app_path = "/mnt/c/Users/Danil/SpCloudApp";//Todo change to linux path
|
//std::string publish_app_path = "/mnt/c/Users/Danil/SpCloudApp";//Todo change to linux path
|
||||||
std::string publish_app_path = "/home/danilt2000/SpCloud/SpCloudApp";//Todo change to linux path
|
//std::string publish_app_path = "/home/danilt2000/SpCloudMain/SpCloudApp";//Todo change to linux path
|
||||||
|
std::string publish_app_path = "/home/danilt2000/SpCloud/";//Todo change to linux path
|
||||||
//std::string publish_app_path = "C:/Temps/";// Todo delete if not needed
|
//std::string publish_app_path = "C:/Temps/";// Todo delete if not needed
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#pragma once
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class CommandService
|
class CommandService
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include "CommandService.cpp"
|
#include "CommandService.cpp"
|
||||||
|
|
||||||
class FileProcessingService
|
class FileProcessingService
|
||||||
@@ -18,6 +18,7 @@ public:
|
|||||||
std::ofstream ofs(filename, std::ios::binary);
|
std::ofstream ofs(filename, std::ios::binary);
|
||||||
if (!ofs) return false;
|
if (!ofs) return false;
|
||||||
ofs << content;
|
ofs << content;
|
||||||
|
|
||||||
return ofs.good();
|
return ofs.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,11 +26,13 @@ public:
|
|||||||
std::filesystem::create_directories(path);
|
std::filesystem::create_directories(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void unzip(const std::string& file_path, const std::string& final_files_directory) {
|
void unzip(const std::string& file_path, const std::string& final_files_directory) {
|
||||||
create_directory(final_files_directory);
|
create_directory(final_files_directory);
|
||||||
|
|
||||||
//Windows version
|
//Windows version
|
||||||
//std::string command = R"(powershell -Command "& \"C:\Program Files\WinRAR\WinRAR.exe\" x \")" + file_path + R"(\" \")" + final_files_directory + R"(\")";
|
//std::string command = R"(powershell -Command "& \"C:\Program Files\WinRAR\WinRAR.exe\" x \")" + file_path + R"(\" \")" + final_files_directory + R"(\")";
|
||||||
|
std::cout << "unzip start\n";
|
||||||
|
|
||||||
//Linux version
|
//Linux version
|
||||||
//std::string command = "unzip " + file_path + " -d " + final_files_directory;
|
//std::string command = "unzip " + file_path + " -d " + final_files_directory;
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
#include "SpCloudMain.h"
|
#include "SpCloudMain.h"
|
||||||
#include "httplib.h"
|
#include "httplib.h"
|
||||||
|
#include "spdlog.h"
|
||||||
|
#include "basic_file_sink.h"
|
||||||
#include "Controllers/PublishController.cpp"
|
#include "Controllers/PublishController.cpp"
|
||||||
//#include "Service/AuthorizationService.cpp"
|
//#include "Service/AuthorizationService.cpp"
|
||||||
//#include "Service/FileProcessingService.cpp"
|
//#include "Service/FileProcessingService.cpp"
|
||||||
@@ -14,12 +15,15 @@ using namespace std;
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
std::cout << "SpCloud start\n";
|
std::cout << "SpCloud start\n";
|
||||||
|
|
||||||
httplib::Server svr;
|
httplib::Server svr;
|
||||||
|
|
||||||
svr.Get("/ping", [](const httplib::Request& req, httplib::Response& res)
|
svr.Get("/ping", [](const httplib::Request& req, httplib::Response& res)
|
||||||
{
|
{
|
||||||
|
std::cout << "Ping-\n";
|
||||||
|
|
||||||
res.set_content("Pong", "text/plain");
|
res.set_content("Pong", "text/plain");
|
||||||
|
|
||||||
httplib::Headers test = req.headers;
|
httplib::Headers test = req.headers;
|
||||||
|
|||||||
Reference in New Issue
Block a user