Import infpnt files to android version

This commit is contained in:
Yousef Khadadeh 2026-06-01 15:42:33 +03:00
parent cde106eba7
commit 0da317e87c
17 changed files with 135 additions and 9 deletions

View file

@ -189,3 +189,16 @@ std::vector<std::string> glob_path_as_string_list(const std::filesystem::path& f
toRet[i] = pathToStr(std::filesystem::path(filesInPath[i]));
return toRet;
}
std::filesystem::path sdl_safe_copy_file(const std::filesystem::path& toPath, const std::filesystem::path& fileToCopy, const std::string& fileName, const std::string& fileExtension) {
std::vector<std::string> toFolderListNames;
try {
toFolderListNames = glob_path_as_string_list(toPath, "*", 0, [&](const auto& p){ return p.stem().string();});
} catch(...) {
SDL_CreateDirectory(toPath.string().c_str());
}
std::string newFileName = ensure_string_unique(toFolderListNames, std::filesystem::path(fileName).stem().string());
std::filesystem::path newPath = toPath / (newFileName + "." + fileExtension);
SDL_CopyFile(fileToCopy.string().c_str(), newPath.string().c_str());
return newPath;
}

View file

@ -36,3 +36,4 @@ std::string remove_carriage_returns_from_str(std::string s);
std::string ensure_string_unique(const std::vector<std::string>& stringList, std::string str);
std::string sdl_time_to_nice_access_time(const SDL_DateTime& t, SDL_DateFormat dF, SDL_TimeFormat tF);
std::vector<std::string> glob_path_as_string_list(const std::filesystem::path& folder, const char* globStr, SDL_GlobFlags globFlags, const std::function<std::string(const std::filesystem::path)>& pathToStr);
std::filesystem::path sdl_safe_copy_file(const std::filesystem::path& toPath, const std::filesystem::path& fileToCopy, const std::string& fileName, const std::string& fileExtension);