New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot load files containing unicode. #18
Comments
Can you try using the raw bindings directly by importing soloud-sys: use soloud_sys::soloud::*;
fn main() {
unsafe {
let sl = Soloud_create();
Soloud_init(sl);
Soloud_setGlobalVolume(sl, 3.0);
let wav = Wav_create();
let ret = Wav_load(wav, "覆.flac\0".as_ptr() as _);
dbg!(ret);
Soloud_play(sl, wav);
while Soloud_getVoiceCount(sl) > 0 {
// calls to play are non-blocking, so we put the thread to sleep
std::thread::sleep(std::time::Duration::from_millis(100));
}
}
} What does this program print? |
|
It's the file not found error. So it's from soloud itself. I currently tried with a similar program on my MacOS and unicode file names work correctly. |
Okay cool, thanks for the help |
So I just tried this on a Windows machine, and it's a soloud issue on Windows, unicode paths work fine on MacOS and Linux. I created a repro in C++: #include <stdio.h>
#include "soloud.h"
#include "soloud_wav.h"
#include "soloud_thread.h"
int main() {
SoLoud::Soloud sl;
SoLoud::Wav wav;
sl.init();
auto ret = wav.load("覆.mp3");
printf("%d\n", ret);
sl.play(wav);
while (sl.getActiveVoiceCount() > 0) {
SoLoud::Thread::sleep(100);
}
sl.deinit();
return 0;
} P.S. I changed the extension to mp3 since that's the file I'm trying out with. |
It should be working now in master since I added the utf-8 compile flag in the CMakeLists.txt: add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>") |
Can you recheck against the master branch: [dependencies]
soloud = { git = "https://github.com/moalyousef/soloud-rs" } |
That is inconvenient. The only workaround I can think of is to use load_mem when file loading fails. |
So I've added the workaround to the lib. If you can check against the master branch. |
Thanks, this has fixed the issue for me. |
When trying to load a file containing unicode characters I get the error
Internal(FileNotFound)
.I'm pretty sure this has something to do with const char * not supporting unicode, so I'm not sure if this is a problem with the bindings.
I've been able to alleviate the problem on Windows by getting the short path and using that instead.
Edit:
Short paths only seem to work on certain files, It might have something to do with file permissions. All I can say is that it's super broken.
The text was updated successfully, but these errors were encountered: