I don't know how C++ programming works since I use python but I tend to move files around quite frequently such as the games folder and having the ability to have . recognized as the current directory would be a nice to have. So instead of specifying a whole directory I can simply just have "./games" as the directory.
I think the code could look something like this:
#include <filesystem>
#include <string>
std::string resolvePath(const std::string& path) {
if (path == "." || path.find("./") == 0) {
// Get the current working directory
std::string current_dir = std::filesystem::current_path().string();
// If path is exactly ".", return current directory
if (path == ".") {
return current_dir;
}
// Otherwise, replace "./" with the current directory
return current_dir + path.substr(1);
}
return path; // Return original path if it doesn't start with "."
}
I don't know how C++ programming works since I use python but I tend to move files around quite frequently such as the games folder and having the ability to have . recognized as the current directory would be a nice to have. So instead of specifying a whole directory I can simply just have "./games" as the directory.
I think the code could look something like this: