Hi, i've been messing with the audio lib, and i could make it work no problem.
I can load a song if i give a path like : "music/music.ogg" which is located in "E:\lovegame"
if I give it the full path : "E:\lovegame\music\music.ogg" or "E:/lovegame/music/music.ogg", I always get the File not found error.
in other words:
printCWD :
E:\lovegame\
love.audio.newSource("music\music.ogg")
OK
love.audio.newSource("E:\lovegame\music\music.ogg")
Crash (File not found)
I even have a function to check wheter or not a file exists on the file system and if i check:
isFileExists("E:\lovegame\music\music.ogg")
True
Am i missing something or is it a bug with newSource() ?
love.audio.newSource Cannot use full path
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: love.audio.newSource Cannot use full path
https://love2d.org/wiki/love.filesystemelfrea wrote: ↑Sun Jan 08, 2023 8:36 pm Hi, i've been messing with the audio lib, and i could make it work no problem.
I can load a song if i give a path like : "music/music.ogg" which is located in "E:\lovegame"
if I give it the full path : "E:\lovegame\music\music.ogg" or "E:/lovegame/music/music.ogg", I always get the File not found error.
in other words:
printCWD :
E:\lovegame\
love.audio.newSource("music\music.ogg")
OK
love.audio.newSource("E:\lovegame\music\music.ogg")
Crash (File not found)
I even have a function to check wheter or not a file exists on the file system and if i check:
isFileExists("E:\lovegame\music\music.ogg")
True
Am i missing something or is it a bug with newSource() ?
In short, at current love 11.4, love filesystem functions is sandboxed to game "save" path and source. So you can't write/read content files outside of that sandbox.
Code: Select all
love.audio.newSource("E:\lovegame\music\music.ogg")
In love 12.0 filesystem will be less restricted so you can wait for it (or build from source wip version, if you know how to) or you can try use libraries such as https://github.com/EngineerSmith/nativefs, that can access any file or directory anywhere, if you need. If you just want to play sounds/other assets from source directory, then there shouldn't be any reason try to get files outside of source/save path
Re: love.audio.newSource Cannot use full path
Ok thanks everyone, im gonna wait for v12.
Actually what im doing is not exactly a game, its a tilemap editor with an audio player included in it, so i wanted to be able to load any song on my computer. but its ok, ive changed it so it scans all files in a music directory instead, so I just have to copy all the songs i want in that directory.
Actually what im doing is not exactly a game, its a tilemap editor with an audio player included in it, so i wanted to be able to load any song on my computer. but its ok, ive changed it so it scans all files in a music directory instead, so I just have to copy all the songs i want in that directory.
Re: love.audio.newSource Cannot use full path
Actually, you can build it from source (branch 12.0-development on Github repo), or if you are signed in Github, you can download artifacts from latest commit here
- slime
- Solid Snayke
- Posts: 3172
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: love.audio.newSource Cannot use full path
Just to be clear: your code won't work as-is in any love version including love 12.
love 12 adds the ability to mount full platform-specific paths to love's virtual filesystem via love.filesystem.mountFullPath, rather than allowing arbitrary platform-dependent paths to be used in any API that takes a filepath. (i.e. you have to mount a folder to the virtual filesystem first, and then use a path based on the mount point parameter you've given to mountFullPath.)
love 12 adds the ability to mount full platform-specific paths to love's virtual filesystem via love.filesystem.mountFullPath, rather than allowing arbitrary platform-dependent paths to be used in any API that takes a filepath. (i.e. you have to mount a folder to the virtual filesystem first, and then use a path based on the mount point parameter you've given to mountFullPath.)
Re: love.audio.newSource Cannot use full path
ok thanks but thats allright i dont use the love filesystem, built my own lib instead
Who is online
Users browsing this forum: GetAsync and 5 guests