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
Asset paths that begin with "/" don't work on Android #352
Comments
Rather strange, there is already some code in the AndroidLocator to remove a leading / |
OK, I have used several days on this one! Here is what extensive debugging finally brought to me.
This means that the locator gets rootPath = "/" .... and now look at jmonkeyengine/jme3-android/src/main/java/com/jme3/asset/plugins/AndroidLocator.java Line 26 in 445f7ed
String assetPath = rootPath + key.getName(); // will start with TWO slashes, like "//Textures/... The // Fix path issues will remove ONE of the slashes, but not the other, which will make the system look in the root of the Linux Android file system :-( Proposed fix 1: Avoid / as path
(best would be to set rootPath = "" but that isnt possible as it would not be valid syntax) Proposed fix 2: ... or change to a while loop instead of an if statement:
Proposed fix 3: replace "//" with "/" before removing heading slash
This bug affects all people that uses the SDK terrain editor (jMonkeyEngine 3.1-beta1-b002-SNAPSHOT) as it wrongly puths forward slashes in the paths of the textures in the .j3o file. See also discussions
|
Until this is fixed in the source the easiest workaround for the wrong path in the AndroidLocator is probably to unregister the locator with the wrong path and register it again with an empty path before you load the scene
|
Closed by PR #1577. |
Due to the changes in jME 3.1 to use Android's
AssetManager
instead of theClasspathLocator
, paths that begin with a forward slash no longer work.The text was updated successfully, but these errors were encountered: