Hi All,
I’m not sure if this is something that just isn’t possible, or if there’s some sort of bug with the WWW implementation for .jar files.
I have a .flac file in my streamingassets folder with the following name and JAR path
File: F#1_GUITHIGHBRIDGEH_tk 50.flac
File Path: jar:file:///data/app/com.cakewalk.testSynth-2/base.apk!/assets/Godin Artisan/HighH/F#1_GUITHIGHBRIDGEH_tk 50.flac
This file fails to load with the following exception:
java.io.FileNotFoundException: JAR entry assets/Godin Artisan/HighH/F not found
So it seems like the ‘#’ character causes the path to get cut off (I have no problem getting the data from a WWW if no ‘#’ is present.) That seems fair, seeing as ‘#’ is a special URL character. The output of my full file path, after calling WWW.EscapeURL, is
jar%3afile%3a%2f%2f%2fdata%2fapp%2fcom.cakewalk.testSynth-2%2fbase.apk%21%2fassets%2fGodin+Artisan%2fHighH%2fF%231_GUITHIGHBRIDGEH_tk+50.flac
which seems… incorrect (and raises a java.net.MalformedURLException.) I also tried escaping just the file name, but that actually yields a StringIndexOutOfBounds exception.
So do .jar URLs need to be escaped differently? Or is it just bad practice on Android to use the ‘#’ character? Our solution has been to write a python script to go through and replace any ‘#’ characters, but we’re dealing with musical samples so many “sharp” keys have a ‘#’ in the file name.
I don’t see this issue with spaces, for the record, which are another forbidden URL character, but I’m not sure what the best practice here is. Any advice will be welcomed gladly.
- John