Yeah I just kind of threw that together. That is what I want it to do. React according to the existence of the file. In the even the file or files exist, the msg would not popup and it would continue with app load.
basically what I want to happen is upon app load check if the file or files exist. if they do then continue loading. If not then msgbox files will be copied. execute the copy msgbox done and then continue app load
basically what I want to happen is upon app load check if the file or files exist. if they do then continue loading. If not then msgbox files will be copied. execute the copy msgbox done and then continue app load
If File.Exists(File.DirRootExternal & "/media/audio/ringtones","limbs2.mp3")=false Then
Msgbox("Files needed will be copied!","NO")
'loadFiles. Place copying procedure here
End If
Below code checks if a file does not exist in SD card, it warns you, then it copies the file from another location assuming it exists. Is this what you are looking for?
B4X:
If File.Exists(File.DirRootExternal & "/media/audio/ringtones","limbs2.mp3")=False Then
Msgbox(File.DirRootExternal & "/media/audio/ringtones" & "/limbs2.mp3" & " does not exist.","NO FILE")
'Below copies the file from the internal to an Sd card folder with the same name.
File.Copy(File.DirInternal & "/media/audio/ringtones","limbs2.mp3",File.DirRootExternal & "/media/audio/ringtones" ,"limbs2.mp3")
End If
So I ended up doing it like this.. which works for on the fly copy and add.
B4X:
If File.Exists(File.DirRootExternal & "/media/audio/ringtones","box.mp3")=False Then
'Below copies the file from the internal to an Sd card folder with the same name.
File.Copy(File.DirAssets,"box.mp3",File.DirRootExternal & "/media/audio/ringtones","ZS_Box.mp3")
u = rm.AddToMediaStore(File.DirRootExternal & "/media/audio/ringtones", "ZS_Box.mp3", "ZS_Box", True, True, True, False)
End If