AUDIO: Fix problem where fluidsynth soundfont could not be loaded

The user can specify a custom soundfont to be used with fluidsynth.
There was previously a hack for the iOS7 backend to get the path to
the document folder where the user can put files in a sandboxed
environment. This hack was removed in commit:
cac06647571a3352cb108faad48af9271a69ce36

The problem however occurred when creating a FSNode from the full
system path because FSNode uses makeFileNodePath, which already
prepends the root. So the full path is added twice which causes the
fileNode.exists() to fail.

Create the FSNode from the path to the soundfont and check if the
file exist. If so then return the full path.
This commit is contained in:
Lars Sundström 2024-02-24 21:29:08 +01:00 committed by Le Philousophe
parent f36f388791
commit addbdc13c5

View File

@ -285,11 +285,11 @@ Common::Path MidiDriver_FluidSynth::getSoundFontPath() const {
if (path.empty())
return path;
// First check if this is a full path
Common::Path fullPath(g_system->getFilesystemFactory()->getSystemFullPath(path.toString(Common::Path::kNativeSeparator)), Common::Path::kNativeSeparator);
Common::FSNode fileNode(fullPath);
if (fileNode.exists())
return fullPath;
Common::FSNode fileNode(path);
if (fileNode.exists()) {
// Return the full system path to the soundfont
return Common::Path(g_system->getFilesystemFactory()->getSystemFullPath(path.toString(Common::Path::kNativeSeparator)), Common::Path::kNativeSeparator);
}
// Then check with soundfontpath
if (ConfMan.hasKey("soundfontpath")) {