Asset Directory SubFolders-How?

JohnK

Active Member
Licensed User
Longtime User
Hi,

I read in these forums its all possible, but I just can not seem to get it to work :BangHead:

Attached is a project with the different attempts, all failing. What am I doing wrong?

B4X:
   Dim M As Map
   M = File.ReadMap(File.DirAssets, "TestSub/test.map")
   'M = File.ReadMap(File.DirAssets, "/TestSub/test.map")
   'M = File.ReadMap(File.DirAssets & "/TestSub", "test.map")
   'M = File.ReadMap(File.DirAssets & "/TestSub/", "test.map")
   'M = File.ReadMap(File.DirAssets & "TestSub/", "test.map")
   Msgbox(M.GetKeyAt(0), M.GetValueAt(0))
 

Attachments

  • AssetSubFolder.zip
    5.8 KB · Views: 244

joseluis

Active Member
Licensed User
Longtime User
This is easy. It works if you rename the dir under Files to "testsub".

ALWAYS use lowercase names for directories and files names.
 
Upvote 0

JohnK

Active Member
Licensed User
Longtime User
ARRGGGGGhhhhhh!

I tried this, and it still fails! :BangHead:

I also tried "Clean Project" after the attached version, to no avail.
 
Upvote 0

joseluis

Active Member
Licensed User
Longtime User
@JohnK The example attached works for me. Really, you only need to lowercase the filename, not necessarily the reference to that filename.

@Erel The problem of exporting as zip is that it doesn't include the files under Files that are not added to the Files tab. So it's not so useful when you are using subfolders under Files.
 

Attachments

  • AssetSubFolder.zip
    1.2 KB · Views: 284
Upvote 0

joseluis

Active Member
Licensed User
Longtime User
Ok now I see.

You named the folder "testssub" but you referenced to it as "testsub". Beware of the double esses.
 
Upvote 0

kiki78

Active Member
Licensed User
Longtime User
I now this is an old post, but I have similar problem.
I test joseluis project, and after correction of directory name it works fine, so ReadMap work.
But if i use File.Exists :
B4X:
log("Exist = " & File.Exists(File.DirAssets, "testsub/test.map")
it return always False.
Is it normal ?
How to do ?

Regards,
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…