From d1e0945f3651d18869f721cd477b786540dec49a Mon Sep 17 00:00:00 2001 From: BoiledElectricity Date: Tue, 16 Jun 2026 13:23:38 -0400 Subject: [PATCH] [qt] fix relative ROM paths passed on the CLI on macOS On Mac, we need to change the relative path to an absolute path or else you could get an error that says format not supported, even if it's a valid switch format. Fixes: https://github.com/eden-emulator/Issue-Reports/issues/404 --- src/yuzu/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 29a1f075fa..ba53f18616 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -19,6 +19,12 @@ #include #endif +#if defined(__APPLE__) +#include +#include +#include +#endif + #include "main_window.h" #ifdef _WIN32 @@ -131,6 +137,16 @@ int main(int argc, char* argv[]) { #endif // _WIN32 #if defined(__APPLE__) + // Convert the relative path to an absolute path before the chdir + char resolved[PATH_MAX]; + for (int i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-u") == 0 || strcmp(argv[i], "-input-profile") == 0) { + ++i; + } else if (argv[i][0] != '-' && argv[i][0] != '/' && realpath(argv[i], resolved)) { + argv[i] = strdup(resolved); + } + } + // If you start a bundle (binary) on OSX without the Terminal, the working directory is "/". // But since we require the working directory to be the executable path for the location of // the user folder in the Qt Frontend, we need to cd into that working directory