'Copies a database file that was added in the Files tab. The database must be copied to a writable location.
'This method copies the database to the storage card. If the storage card is not available the file is copied to the internal folder.
'The target folder is returned.
'If the database file already exists then no copying is done.
Sub CopyDBFromAssets (FileName As String) As String
Try
Dim TargetDir As String
If File.ExternalWritable Then
TargetDir = DBFileDir
Else
TargetDir = File.DirInternal
End If
If File.Exists(TargetDir, FileName) = False Then
File.Copy(File.DirAssets, FileName, TargetDir, FileName)
End If
Return TargetDir
Catch
Log("CopyDBFromAssets " & LastException.Message)
Return ""
End Try
End Sub