This part of my programm tries to rename all folders and subfolders. All other functionality is in another code, here I'm just renaming a single folder by providing a path.
Since rename doesnt seem to work for me I tried using MoveFile.
I understand that it requires an LPCTSTR value.. but the paths I am currently providing (casted from std::filesystem::directory_entry -> std::filesystem::path) -> LPCTSTR) aren't accepted.
I'm getting that I'm not casting it the right way and I probably have to provide it with an "L" in front of the variable, but I can't find nor figure out the syntax.
bool renameFolder(std::string confirmStr3, auto dirEntry, std::string& replacedStr, std::string& insertStr, int& foldername_replacements)
{
std::string path_string = dirEntry.path().string();
path_string = std::filesystem::path(path_string).filename().string();
replace_all(path_string, replacedStr, insertStr);
path_string = getFolderPath(std::filesystem::path(dirEntry).string()) + "\\" + path_string;
if (std::filesystem::path(dirEntry) != std::filesystem::path(path_string))
foldername_replacements++;
//std::filesystem::rename(std::filesystem::path(dirEntry), std::filesystem::path(path_string));
MoveFile(LPCTSTR(std::filesystem::path(dirEntry)), LPCTSTR(std::filesystem::path(path_string)));
}