Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directory interpreted as file #886

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion GAMELISTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ Things to be Aware Of

* If a value matches the default for a particular piece of metadata, ES will not write it to the gamelist.xml (for example, if `genre` isn't specified, ES won't write an empty genre tag; if `players` is 1, ES won't write a `players` tag).

* A `game` can actually point to a folder/directory if the the folder has a matching extension.
* A `game` can actually point to a folder/directory if the the folder has a matching extension. It shows up as a game in ES.
When launch this, if there is a file with the same name as the folder in that folder, that file will be passed to the command as `%ROM%`. Otherwise, just the directory path is passed.

* `folder` metadata will only be used if a game is found inside of that folder.

Expand Down
14 changes: 11 additions & 3 deletions es-app/src/FileData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,17 @@ void FileData::launchGame(Window* window)

std::string command = mEnvData->mLaunchCommand;

const std::string rom = Utils::FileSystem::getEscapedPath(getPath());
const std::string basename = Utils::FileSystem::getStem(getPath());
const std::string rom_raw = Utils::FileSystem::getPreferredPath(getPath());
std::string path = getPath();
if(Utils::FileSystem::isDirectory(path))
{
const std::string path2 = Utils::FileSystem::resolveRelativePath(Utils::FileSystem::getFileName(path), path, false, true);
if(Utils::FileSystem::isRegularFile(path2))
path = path2;
}

const std::string rom = Utils::FileSystem::getEscapedPath(path);
const std::string basename = Utils::FileSystem::getStem(path);
const std::string rom_raw = Utils::FileSystem::getPreferredPath(path);
const std::string name = getName();

command = Utils::String::replace(command, "%ROM%", rom);
Expand Down