[GH-ISSUE #1466] *A NICE TO HAVE ADDITION* Period (.) being represented as current directory for detecting the games folder #490

Closed
opened 2026-02-27 21:06:33 +03:00 by kerem · 1 comment
Owner

Originally created by @HelmXGaming on GitHub (Oct 31, 2024).
Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/1466

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 "."
}
Originally created by @HelmXGaming on GitHub (Oct 31, 2024). Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/1466 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 "." } ```
kerem closed this issue 2026-02-27 21:06:33 +03:00
Author
Owner

@Hermiten commented on GitHub (Nov 11, 2024):

I'm not sure if it's really necessary. Anyone else have an idea ?

<!-- gh-comment-id:2468657832 --> @Hermiten commented on GitHub (Nov 11, 2024): I'm not sure if it's really necessary. Anyone else have an idea ?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#490
No description provided.