Images not being found on Linux port

Hi, I have recently changed my game to use desktopGL so that I can run it on both Windows and Linux. On Windows everything runs correctly, but on Linux the game complains that it can’t find my audio files.

Could not find file "/mnt/C89658099657F702/Work/Games/Point-and-Click Adventure/PACAdventureCross/bin/DesktopGL/AnyCPU/Debug/Content/audio/Countryside.wav"

I load my audio files with this function:

public SoundEffect LoadSound(string path)
        {
            FileStream fileStream = new FileStream(path, FileMode.Open);
            SoundEffect soundEffect = SoundEffect.FromStream(fileStream);
            fileStream.Dispose();
            return soundEffect;
        }

And my files are set to “always copy”.

Does anyone know why it doesn’t work on Linux but it does on Windows?

Hello Andy,

You can use the class TitleContainer to open streams in your MG libraries/Apps. TitleContainer takes care of platform differences and you don’t have to worry about where resources are located.

However, it’s better to use the content pipeline for assets.

1 Like

Check letter case in your filename. The case doesn’t matter on Windows, but does on Linux.

1 Like

Ahhh it was a filename case issue! Thank you!