T Troberg Well-Known Member Licensed User Longtime User Apr 15, 2015 #1 Is there a way to package files so that they end up in subdirectories of File.DirInternal? Example: File.DirInternal/Languages/English.lng File.DirInternal/ColorSchemes/Red.sch And, of course, I messed up when writing the post. It should be File.DirAssets, of course. Last edited: Apr 15, 2015
Is there a way to package files so that they end up in subdirectories of File.DirInternal? Example: File.DirInternal/Languages/English.lng File.DirInternal/ColorSchemes/Red.sch And, of course, I messed up when writing the post. It should be File.DirAssets, of course.
Erel B4X founder Staff member Licensed User Longtime User Apr 15, 2015 #2 Yes. It is possible. You will need to use lower cased names for the folders and files. Upvote 0
T Troberg Well-Known Member Licensed User Longtime User Apr 15, 2015 #3 OK, I can live with lowercase, but how do I get the subdirectories in File.DirAssets and the files in the subdirs? Upvote 0
OK, I can live with lowercase, but how do I get the subdirectories in File.DirAssets and the files in the subdirs?
JoanRPM Active Member Licensed User Longtime User Apr 15, 2015 #4 For expample, I load a bmp (in help directory) like this: Code: Copy Dim Bitmap1 As Bitmap Dim imvT1 As ImageView Bitmap1.Initialize(File.DirAssets,"help/t1.png") 'ignore imvT1.Initialize("") imvT1.Bitmap = Bitmap1 Activity.AddView(imvT1,262dip,51dip+90dip,3dip,145dip) Upvote 0
For expample, I load a bmp (in help directory) like this: Code: Copy Dim Bitmap1 As Bitmap Dim imvT1 As ImageView Bitmap1.Initialize(File.DirAssets,"help/t1.png") 'ignore imvT1.Initialize("") imvT1.Bitmap = Bitmap1 Activity.AddView(imvT1,262dip,51dip+90dip,3dip,145dip)
T Troberg Well-Known Member Licensed User Longtime User Apr 15, 2015 #5 Loading it is not the problem, how do I add the file to the project so that it ends up in a subdirectory? I can't find a way to define the dir structure for DirAssets. Upvote 0
Loading it is not the problem, how do I add the file to the project so that it ends up in a subdirectory? I can't find a way to define the dir structure for DirAssets.
thedesolatesoul Expert Licensed User Longtime User Apr 15, 2015 #6 In your B4A project there is a 'Files' directory. You can make the structure there, and it will be included in the apk. It wont show up in the Files tab in the IDE. Upvote 0
In your B4A project there is a 'Files' directory. You can make the structure there, and it will be included in the apk. It wont show up in the Files tab in the IDE.
T Troberg Well-Known Member Licensed User Longtime User Apr 15, 2015 #7 Ah, it was that easy... Do I also have to include the files in the IDE, or is the entire Files dir included automatically? Upvote 0
Ah, it was that easy... Do I also have to include the files in the IDE, or is the entire Files dir included automatically?
thedesolatesoul Expert Licensed User Longtime User Apr 15, 2015 #8 I believe the entire Files folder is included so be careful not to put any junk in it. Upvote 0
NJDude Expert Licensed User Longtime User Apr 15, 2015 #9 thedesolatesoul said: I believe the entire Files folder is included so be careful not to put any junk in it. Click to expand... Yes, any files or directories in the FILES folder gets added to the APK, that directory should only contain the files pertaining to the app and nothing else. Upvote 0
thedesolatesoul said: I believe the entire Files folder is included so be careful not to put any junk in it. Click to expand... Yes, any files or directories in the FILES folder gets added to the APK, that directory should only contain the files pertaining to the app and nothing else.
T Troberg Well-Known Member Licensed User Longtime User Apr 16, 2015 #10 Thanks, that trimmed down the size of my APK! My image editor saves backup copies of the files as you work on them... Upvote 0
Thanks, that trimmed down the size of my APK! My image editor saves backup copies of the files as you work on them...
T Troberg Well-Known Member Licensed User Longtime User Apr 20, 2015 #11 NJDude said: Yes, any files or directories in the FILES folder gets added to the APK, that directory should only contain the files pertaining to the app and nothing else. Click to expand... Nope, didn't work. I just tried it, and only files directly in the Files folder where included, not subdirectories or files in them. Example: Info.png exists in both Files/ and Files/Icons/. Presumably, both should then be on the device. Code: Copy 'Works bm.Initialize(File.DirAssets, "info.png") 'Doesn't work bm.Initialize(File.DirAssets & "/icons", "info.png") Upvote 0
NJDude said: Yes, any files or directories in the FILES folder gets added to the APK, that directory should only contain the files pertaining to the app and nothing else. Click to expand... Nope, didn't work. I just tried it, and only files directly in the Files folder where included, not subdirectories or files in them. Example: Info.png exists in both Files/ and Files/Icons/. Presumably, both should then be on the device. Code: Copy 'Works bm.Initialize(File.DirAssets, "info.png") 'Doesn't work bm.Initialize(File.DirAssets & "/icons", "info.png")
thedesolatesoul Expert Licensed User Longtime User Apr 20, 2015 #12 Is the folder lower case in the Files directory? "Icons" or "icons"? Use lowercase filenames. It definitely works. Sometimes Windows plays tricks on you, so renaming doesnt work, you might have to delete the folder and recreate it. Upvote 0
Is the folder lower case in the Files directory? "Icons" or "icons"? Use lowercase filenames. It definitely works. Sometimes Windows plays tricks on you, so renaming doesnt work, you might have to delete the folder and recreate it.
T Troberg Well-Known Member Licensed User Longtime User Apr 20, 2015 #13 It looks like lowercase, but I'll recreate it and see. Likewise, I'll check the names from the command line. Upvote 0
It looks like lowercase, but I'll recreate it and see. Likewise, I'll check the names from the command line.
T Troberg Well-Known Member Licensed User Longtime User Apr 20, 2015 #14 Found the problem. Apparently, File.DirAssets doesn't work like a normal dir. Changing the code to this helped: Code: Copy bm.Initialize(File.DirAssets, "icons/" & IconFileName) In other words, the dir seems to be part of the filename, instead of the path. Upvote 0
Found the problem. Apparently, File.DirAssets doesn't work like a normal dir. Changing the code to this helped: Code: Copy bm.Initialize(File.DirAssets, "icons/" & IconFileName) In other words, the dir seems to be part of the filename, instead of the path.
thedesolatesoul Expert Licensed User Longtime User Apr 20, 2015 #15 Interesting. I usually use File.Combine to concatenate any paths rather than an '&'. Upvote 0