com.jme3.asset.plugins.FileLocator.locate BUG?

When I try loading my asset I get the following Error:



Exception in thread “Thread-5” com.jme3.asset.AssetNotFoundException: Asset name doesn’t match requirements.

“C:ProjectsOGFClientOGFresourcescache2.0.jpg” doesn’t match “C:ProjectsOGFClient…OGFresourcescache2.0.jpg”

at com.jme3.asset.plugins.FileLocator.locate(FileLocator.java:93)



Is this a known problem or did I stumble upon something?

This worked before I went on holiday so I think it may have something to do with code changes since then.

This issue exists since the FileLocator has been made case sensitive. @Momoko_Fan: As these kinds of paths (folder/…/./file) have probably been created here and there (e.g. in the WorldForge asset pack, in some j3o files etc.) its probably best to flatten these at a later stage as well as wherever they come from.

Funny but I’m getting this exact issue myself. I see that the latest change on the FileLocator file includes the following check:



[java]

String canonical = file.getCanonicalPath();

String absolute = file.getAbsolutePath();

if (!canonical.endsWith(absolute)){

throw new AssetNotFoundException(“Asset name doesn’t match requirements.n”+

“”" + canonical + “” doesn’t match “” + absolute + “”");

[/java]



In the beginning of my app, I registered the FileLocator like ths:



[java]

assetManager.registerLocator(".", “com.jme3.asset.plugins.FileLocator”);

[/java]



This causes the problem to arise as the canonical filename strips the “.” from the path but the absolute filename does not. I changed my code to:



[java]

assetManager.registerLocator(System.getProperty(“user.dir”), “com.jme3.asset.plugins.FileLocator”);

[/java]



and that solves my problem. Wondering if this is the correct approach. I am running on OSX btw.

That is one approach. I’d argue that if AssetManager is going to be strict with ‘.’ in paths then it also needs to interpret:

assetManager.registerLocator(".", “com.jme3.asset.plugins.FileLocator”);



Correctly… which is essentially (something we could do internally perhaps):

assetManager.registerLocator( new File(".").getCanonicalPath(), “com.jme3.asset.plugins.FileLocator”);



…which is a slightly safer version if what you’ve done.

ok, I tried the solution provided by pspeed.

It helped some, now I have the following error:



“C:ProjectsOGFClientOGFresourcescache2.0.jpg” doesn’t match “C:ProjectsOGFClient.OGFresourcescache2.0.jpg”



So there is one less “.” in there, but still there is 1 “.” Which means it still doesn’t work…

ok, my bad. This was a problem in my config file…