Fix replacement
This commit is contained in:
@@ -29,6 +29,7 @@ public:
|
|||||||
while(!is.eof())
|
while(!is.eof())
|
||||||
{
|
{
|
||||||
std::getline(is, tmp);
|
std::getline(is, tmp);
|
||||||
|
std::cout << tmp << std::endl;
|
||||||
if (tmp.at(0) == '#') // ignore comments
|
if (tmp.at(0) == '#') // ignore comments
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
#include "usermanager.h"
|
#include "usermanager.h"
|
||||||
#include "configfilemanager.h"
|
#include "configfilemanager.h"
|
||||||
|
|
||||||
|
configfilemanager cfm;
|
||||||
userManager manager;
|
userManager manager;
|
||||||
std::condition_variable cv;
|
std::condition_variable cv;
|
||||||
std::mutex mtx;
|
std::mutex mtx;
|
||||||
configfilemanager cfm;
|
|
||||||
|
|
||||||
std::vector<std::string> splitString(const std::string& str, char delimiter = '|')
|
std::vector<std::string> splitString(const std::string& str, char delimiter = '|')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ std::string userManager::getScanCommandFromUser(const std::string &user, configf
|
|||||||
std::string contname = cfm.at("NEXTCLOUD_CONTAINER_NAME");
|
std::string contname = cfm.at("NEXTCLOUD_CONTAINER_NAME");
|
||||||
std::string baseCommand;
|
std::string baseCommand;
|
||||||
std::string userCommand;
|
std::string userCommand;
|
||||||
|
std::string placeholder("%1%");
|
||||||
|
|
||||||
if (user.find("__groupfolder") != std::string::npos)
|
if (user.find("__groupfolder") != std::string::npos)
|
||||||
{
|
{
|
||||||
@@ -18,8 +19,8 @@ std::string userManager::getScanCommandFromUser(const std::string &user, configf
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
while ((pos = baseCommand.find("%1%", pos)) != std::string::npos) {
|
while ((pos = baseCommand.find(placeholder, pos)) != std::string::npos) {
|
||||||
baseCommand.replace(pos, contname.length(), contname);
|
baseCommand.replace(pos, placeholder.length(), contname);
|
||||||
pos += contname.length(); // Move past the replacement
|
pos += contname.length(); // Move past the replacement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user