Bug? DirAssets

stevel05

Expert
Licensed User
Longtime User
I have a problem using DirAssets to load files from the files tab, Layouts work fine. but loading an image fails.

Running the attached app which is simply this code plus resources:

B4X:
    Log("From DirApp "&File.Exists(File.Combine(File.GetFileParent(File.DirApp),"Files"),"icon.jpg"))
    Log("From DirAssets "&File.Exists(File.DirAssets,"icon.jpg"))
    Image1.Initialize(File.DirAssets,"icon.jpg")
    Log("DirAssets = " & File.DirAssets)
    Log("DirApp = " & File.DirApp)


on my PC gives this in the log:

Program started.
From DirApp true
From DirAssets false
DirAssets = AssetsDir
DirApp = C:\Basic4J\Testing\DIRASS~1\Objects

I don't see the same issue using B4a.

Win 8.1 Intel Core i5 6GB.
 

Attachments

  • dat.zip
    2.3 KB · Views: 256

agraham

Expert
Licensed User
Longtime User
It looks like a bug, or rather a feature that didn't get implemented. AssetsDir is a virtual folder name in B4A and B4J used to indicate the application assets but, unlike in B4A, Erel seems to have overlooked putting the check for it in the B4J File.Exists. :(
 

stevel05

Expert
Licensed User
Longtime User
Ok Thank you both.
 
Top