feature add filesystem
Some checks failed
build-crpc / build (Debug, mingw-w64-xi686.toolchain.cmake) (push) Waiting to run
build-crpc / build (Release, mingw-w64-x86_64.toolchain.cmake) (push) Waiting to run
build-crpc / build (Release, mingw-w64-xi686.toolchain.cmake) (push) Waiting to run
build-crpc / build (Debug, host.toolchain.cmake) (push) Failing after 2m4s
build-crpc / build (Debug, mingw-w64-x86_64.toolchain.cmake) (push) Failing after 1m53s
build-crpc / build (Release, host.toolchain.cmake) (push) Has been cancelled

This commit is contained in:
tqcq 2023-12-03 12:42:44 +08:00
parent f0175170ec
commit 957fd68868
4 changed files with 24 additions and 19 deletions

View File

@ -6,6 +6,7 @@
#include <sstream>
#include <fstream>
#include <iostream>
#include <filesystem>
namespace tqcq {

View File

@ -3,27 +3,31 @@
//
#include "plugin.h"
#include <sys/stat.h>
#include <filesystem>
namespace tqcq {
static void EnsureDirectoryExist(std::string path)
{
std::string::size_type pos = 0;
bool is_end = false;
while (!is_end) {
pos = path.find('/', pos);
if (pos == std::string::npos) {
is_end = true;
}
std::string dir = path.substr(0, pos);
int status = mkdir(dir.c_str(), 0755);
if (status != 0 && errno != EEXIST) {
perror("mkdir");
exit(1);
}
pos++;
}
// create path recursively
std::filesystem::path p(path);
if (!std::filesystem::exists(p.parent_path())) { std::filesystem::create_directories(p.parent_path()); }
// bool is_end = false;
// while (!is_end) {
// pos = path.find('/', pos);
// if (pos == std::string::npos) {
// is_end = true;
// }
// std::string dir = path.substr(0, pos);
// int status = mkdir(dir.c_str(), 0755);
// if (status != 0 && errno != EEXIST) {
// perror("mkdir");
// exit(1);
// }
// pos++;
// }
}
Plugin::Plugin(std::string generate_path, std::string generate_prefix)

View File

@ -3,8 +3,8 @@ set(TOOLCHAIN_PREFIX i686-w64-mingw32)
set(CMAKE_CROSSCOMPILING TRUE)
# cross compilers to use for C, C++ and Fortran
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)

View File

@ -3,8 +3,8 @@ set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
set(CMAKE_CROSSCOMPILING TRUE)
# cross compilers to use for C, C++ and Fortran
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)