41 #ifndef __OPENFLUID_WARESDEV_WARESRCHELPERS_HPP__
42 #define __OPENFLUID_WARESDEV_WARESRCHELPERS_HPP__
58 namespace openfluid {
namespace waresdev {
66 std::string m_BuildDirRegexStr =
"_build-";
67 std::string ModeArg =
"(release|debug)";
68 std::string VersionArg =
"[0-9]+\\.[0-9]+";
69 std::string VersionMajorMinorStr;
70 std::string CurrentVersionRegex;
75 WarePurgeHandler(
bool CurrentVersion,
bool OtherVersions,
bool ReleaseMode,
bool DebugMode)
81 if (CurrentVersion && !OtherVersions)
83 VersionArg = CurrentVersionRegex;
85 else if (!CurrentVersion && OtherVersions)
87 VersionArg =
"(?!"+CurrentVersionRegex+
")[0-9]+\\.[0-9]+";
90 if (ReleaseMode && !DebugMode)
94 else if (!ReleaseMode && DebugMode)
99 m_BuildDirRegexStr = m_BuildDirRegexStr + ModeArg +
"-" + VersionArg;
108 std::function<
void(std::string, std::string)> WriteMessageFunc,
109 std::function<
void(
bool)> EmitSignal)
111 std::regex FilterRegExp(m_BuildDirRegexStr);
115 WriteMessageFunc(WarePath.
toGeneric() +
": Ware path does not exists ",
"Error");
119 for (
const auto& Entry : std::filesystem::directory_iterator(WarePath.
stdPath()))
122 if (std::regex_match(EntryFSP.filename(), FilterRegExp))
124 EntryFSP.removeDirectory();
126 if(EntryFSP.isDirectory())
128 WriteMessageFunc(EntryFSP.filename() +
": Error ",
"Error");
133 WriteMessageFunc(EntryFSP.filename() +
": Deleted ",
"Success");
148 inline static const std::vector<std::string>
CppFilesExt = {
"cpp",
"hpp",
"cc",
"hh",
"cxx",
"hxx",
"C",
"H",
"h"};
188 const std::set<std::string>& ROUsers,
189 const std::set<std::string>& RWUsers={});
230 const std::string& ParentPath=
".",
const std::string& WareID=
"",
static std::string getVersionMajorMinor()
Definition: Environment.hpp:198
Definition: WareSrcHelpers.hpp:62
void purge(openfluid::tools::FilesystemPath WarePath, std::function< void(std::string, std::string)> WriteMessageFunc, std::function< void(bool)> EmitSignal)
Definition: WareSrcHelpers.hpp:107
WarePurgeHandler(bool CurrentVersion, bool OtherVersions, bool ReleaseMode, bool DebugMode)
Definition: WareSrcHelpers.hpp:75
~WarePurgeHandler()
Definition: WareSrcHelpers.hpp:140
#define OPENFLUID_API
Definition: dllexport.hpp:86
WareType
Definition: TypeDefs.hpp:61
int OPENFLUID_API cloneWare(const std::string &SourceURL, const std::string &SourceType="hub", const std::string &ParentPath=".", const std::string &WareID="", const std::string &WareType="")
static const std::vector< std::string > CppFilesExt
Definition: WareSrcHelpers.hpp:148
bool OPENFLUID_API IsCppFile(const openfluid::tools::FilesystemPath &FileObj)
bool OPENFLUID_API hasUserAccess(const std::string &UserName, bool IsLoggedIn, const std::set< std::string > &ROUsers, const std::set< std::string > &RWUsers={})
bool OPENFLUID_API isWareInCurrentWorkspace(const std::string &WarePath)
std::map< std::string, std::string > OPENFLUID_API initializeConfigureVariables()
bool OPENFLUID_API IsCMakeFile(const openfluid::tools::FilesystemPath &FileObj)
Definition: ApplicationException.hpp:47