Add STL version of Appendslash

This commit is contained in:
Kawe Mazidjatari 2023-07-28 14:45:04 +02:00
parent e45c0fde7d
commit b7b42786ab
2 changed files with 13 additions and 0 deletions

View File

@ -33,6 +33,8 @@ string CreateTimedFileName();
string CreateUUID();
void CreateDirectories(string svInput, string* pszOutput = nullptr, bool bWindows = false);
void AppendSlash(string& svInput, const char separator = '\\');
string ConvertToWinPath(const string& svInput);
string ConvertToUnixPath(const string& svInput);

View File

@ -409,6 +409,17 @@ void CreateDirectories(string svInput, string* pszOutput, bool bWindows)
fs::create_directories(fspPathOut);
}
///////////////////////////////////////////////////////////////////////////////
// For appending a slash at the end of the string if not already present.
void AppendSlash(string& svInput, const char separator)
{
char lchar = svInput[svInput.size() - 1];
if (lchar != '\\' && lchar != '/')
{
svInput.push_back(separator);
}
}
///////////////////////////////////////////////////////////////////////////////
// For converting file paths to windows file paths.
string ConvertToWinPath(const string& svInput)