Skip to content

Problems with file paths in Windows #8450

@QuetzalcoutlDev

Description

@QuetzalcoutlDev

Hi, I've been developing a game with GDevelop and I've encountered a small problem related to how the engine handles file paths.

I access an audio file already listed in the game's resources from JavaScript (it uses an extension) like this:
Image

But there's a problem.

If I try to use "assets/sounds/" + filename + ".ogg", I get this error:
Image

That is, if the resource is listed under this name
Image

What's happening is that to fix it, I have to manually change the resource name like this:
Image
Image

Instead of the resource name being "assets\sounds\ringtone.ogg", it has to be "assets/sounds/ringtone.ogg"

But I don't really understand why the engine uses a backslash \ in the resource name on Windows, but uses a forward slash / in the path the engine recognizes.
Image

Is there a way to resolve this? Or am I missing something?

Steps to reproduce

  1. Load a file to list it in the resources.
  2. Use an extension like "Sounds and music by filename".
  3. Use a / in Windows to call the sound from game events.
  4. Try using \ as well without changing the resource name.

GDevelop platform

Desktop

GDevelop version

5.6.262

Platform info

Details

OS (e.g. Windows, Linux, macOS, Android, iOS)

Windows

OS Version (e.g. Windows 10, macOS 10.15)

Windows 11 Pro

Additional context

I don't consider it an extension problem, but rather a problem that comes to light when using said extension; the engine confuses the paths and for some reason cannot find the file if you do not put the / in the resource name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions