41 #ifndef __OPENFLUID_WARESDEV_WARESRCHELPERS_HPP__
42 #define __OPENFLUID_WARESDEV_WARESRCHELPERS_HPP__
57 namespace openfluid {
namespace waresdev {
65 std::string m_BuildDirRegexStr =
"_build-";
66 std::string ModeArg =
"(release|debug)";
67 std::string VersionArg =
"[0-9]+\\.[0-9]+";
68 std::string VersionMajorMinorStr;
69 std::string CurrentVersionRegex;
74 WarePurgeHandler(
bool CurrentVersion,
bool OtherVersions,
bool ReleaseMode,
bool DebugMode)
80 if (CurrentVersion && !OtherVersions)
82 VersionArg = CurrentVersionRegex;
84 else if (!CurrentVersion && OtherVersions)
86 VersionArg =
"(?!"+CurrentVersionRegex+
")[0-9]+\\.[0-9]+";
89 if (ReleaseMode && !DebugMode)
93 else if (!ReleaseMode && DebugMode)
98 m_BuildDirRegexStr = m_BuildDirRegexStr + ModeArg +
"-" + VersionArg;
107 std::function<
void(std::string, std::string)> WriteMessageFunc,
108 std::function<
void(
bool)> EmitSignal)
110 std::regex FilterRegExp(m_BuildDirRegexStr);
114 WriteMessageFunc(WarePath.
toGeneric() +
": Ware path does not exists ",
"Error");
118 for (
const auto& Entry : std::filesystem::directory_iterator(WarePath.
stdPath()))
121 if (std::regex_match(EntryFSP.filename(), FilterRegExp))
123 EntryFSP.removeDirectory();
125 if(EntryFSP.isDirectory())
127 WriteMessageFunc(EntryFSP.filename() +
": Error ",
"Error");
132 WriteMessageFunc(EntryFSP.filename() +
": Deleted ",
"Success");
147 inline static const std::vector<std::string>
CppFilesExt = {
"cpp",
"hpp",
"cc",
"hh",
"cxx",
"hxx",
"C",
"H",
"h"};
187 const std::set<std::string>& ROUsers,
188 const std::set<std::string>& RWUsers={});
static std::string getVersionMajorMinor()
Definition: Environment.hpp:196
Definition: WareSrcHelpers.hpp:61
void purge(openfluid::tools::FilesystemPath WarePath, std::function< void(std::string, std::string)> WriteMessageFunc, std::function< void(bool)> EmitSignal)
Definition: WareSrcHelpers.hpp:106
WarePurgeHandler(bool CurrentVersion, bool OtherVersions, bool ReleaseMode, bool DebugMode)
Definition: WareSrcHelpers.hpp:74
~WarePurgeHandler()
Definition: WareSrcHelpers.hpp:139
#define OPENFLUID_API
Definition: dllexport.hpp:86
static const std::vector< std::string > CppFilesExt
Definition: WareSrcHelpers.hpp:147
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