Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions incrontab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,17 @@ bool IncronTabEntry::Parse(const std::string& rStr, IncronTabEntry& rEntry)
std::string IncronTabEntry::GetSafePath(const std::string& rPath)
{
std::ostringstream stream;

SIZE len = rPath.length();
for (SIZE i = 0; i < len; i++) {
if (rPath[i] == ' ') {
stream << "\\ ";
}
else if (rPath[i] == '\\') {
stream << "\\\\";
if (rPath[i] == '\'') {
stream << "'\\''"; // close single quote, place escaped one, open another single quote
}
else {
stream << rPath[i];
}
}

return stream.str();
}

Expand Down