Android Question Compare DirAssets and DirInternal db

Discussion in 'Android Questions' started by ALBRECHT, Jul 22, 2019.

  1. ALBRECHT

    ALBRECHT Active Member Licensed User

    Hello,

    when i compare that 2 files :

    That is Because i regulary update the tables inside "strings.db" file from the "DB Brower SqlLite" tools

    Code:
    'LocalStrings ***************************************************************
        Dim FileName As String = "strings.db"
        
    Dim TargetDir As String = File.DirInternal

        
    If File.Exists(TargetDir, FileName) = False Then
            
    File.Copy(File.DirAssets, FileName, TargetDir, FileName)
            
    Log("Copy File")
        
    Else
            
    If File.Size(File.DirAssets, FileName) = File.Size(File.DirInternal, FileName) Then
                
    Log("Same File")
            
    Else
                
    File.Delete(TargetDir, FileName)
                
    File.Copy(File.DirAssets, FileName, TargetDir, FileName)
                
    Log("Copy File Again")
            
    End If
        
    End If
    Even i check with File.Size or File.LastModified, the Log line is always : "Copy File Again"

    - Is it a coding mistake ?

    - Or is there an other way to compare that 2 files ?


    Thanks
    Michel

     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You cannot check the size of assets files.

    What is the size of the original file? If it is not too large then just copy it when the app starts.
     
  3. ALBRECHT

    ALBRECHT Active Member Licensed User

    ok Erel, it was simply to avoid unnecessary transactions, but in fact the .db file size is less than 800Ko
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice