Android Question Upper case filename problem on DirAssets

Midimaster

Active Member
Licensed User
I use Version 10.2 and recognized a strange behavior.

I have a file "Piano1.wav" in a personal folder
I added this file "Piano1.wav" to the project with the File Manager.
Now in the file Manager it looks like "Piano1.wav"
In the windows manager it appears now as "piano1.wav" in "..project/files"

Now I start the app...

and log the content of the DirAssets with
B4X:
 Files.ListDir(File.DirAssets)
in the logger it apears as "piano1.wav"

now I check the file with
B4X:
File.Exists(File.DirAssets,"Piano1.wav")
and this returns FALSE

now I copy the file to DirInternal and it works!!!
B4X:
    File.Copy(File.DirAssets,FileName,File.DirInternal,FileName)


here is the code
B4X:
Sub LoadAudioSample(FileName As String)
    Log ("filename=" & FileName )
    Log(File.ListFiles(File.DirAssets))
    Log( File.Exists(File.DirAssets, FileName))
    File.Copy(File.DirAssets,FileName,File.DirInternal,FileName)
    Log( File.Exists(File.Dirinternal, FileName))
end sub

and her is the logging:
....
** Activity (main) Create, isFirst = true **
filename=Piano1.wav
(ArrayList) [piano0.wav, _assets_map, piano1.wav, bassdrum.wav, snaredrum.wav, layout.bal, piano4.wav, applaus.wav, piano7.wav]
false
true


Is it normal that a file "Piano1.wav" would appear as "piano1.wav" ?


and also File.Exists(File.DirAssets,"Piano1.wav") would return FALSE?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Moved to the questions forum.
All asset files are lower cased. This happens automatically when you add the files to the files tab.
It will also happen after you click on the Sync button, in case you added a file to the Files folder directly.

File.Exists doesn't work with the assets folder and is not really needed as you know which files are there.
 
Upvote 0

Midimaster

Active Member
Licensed User
lower case: ok. I did no realize this until today.
file.exists: this makes sense, of course.

I would have needed the exact FileSize of a dozend of WAV-files in the DirAssets to kick away the 44Bytes of header when loading them. Now I copied the files to the DirInternal and scanned them there.
 
Upvote 0
Top