B4J Question folders inside Files folder of the project...

DavideV

Active Member
Licensed User
Longtime User
Hi,
is it possible to create folders inside the 'Files' folder of the project (to organize files) ?

B4X:
'the files for maintenance are in the maintenance dir inside dirasset, always copy these files when run the app
    File.Copy(File.DirAssets, "maintenance\login.html",Mndir,"login.html")
    File.Copy(File.DirAssets, "maintenance\admin.html",Mndir,"admin.html")
    File.Copy(File.DirAssets, "maintenance\error.html",Mndir,"error.html")

i tried but it ends in error with file not found exception.
Moving the files directly into the Files folder of the project works fine:

B4X:
    File.Copy(File.DirAssets, "login.html",Mndir,"login.html")
    File.Copy(File.DirAssets, "admin.html",Mndir,"admin.html")
    File.Copy(File.DirAssets, "error.html",Mndir,"error.html")
I would like to keep files organized in folders in the project, sometime they are so much.

The same code (with folders inside 'files' folder) works with B4A
 
Last edited:

Daestrum

Expert
Licensed User
Longtime User
DirAssets is read only so would all it's sub folders.
You can program round it but if you move the jar it will break, but running it in IDE in Debug or Release will work.
B4X:
File.Copy(File.DirAssets,"flips.png",File.DirApp&"/../files","/tmp/test.png")
will copy the file from DirAssets to effectively DirAssets/tmp/
But as I said if you move the jar it breaks.
 
Last edited:
Upvote 0

DavideV

Active Member
Licensed User
Longtime User
Nice, thx.
The destination folder is not a problem.
The problem is that i can't read from subfolder of dirasset in b4j. Is that normal?
 
Upvote 0
Top