Is this a path problem or what?

Malky

Active Member
Licensed User
Longtime User
Hi, I install the app initially and if I start it again and all images are downloaded and the database is populated, I expect to continue.

But.... I test for the existence of the DB and it appears not to be there although it does exist on the same path?

The SQL.Initialize function verifies it?

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Start = False
   CreateDir
   ToastMessageShow(SD_PATH, True)
   Log("PATH = " & SD_PATH)
   SQL1.Initialize(SD_PATH, "homerbg.db", True)
   scvMain.Initialize(500)
   Activity.AddView(scvMain,0,0,100%x,100%y)
   ' Query db to see if the app has been activated
   'SQL1.ExecQuerySingleResult("SELECT appActivated FROM system")
   
   If (File.Exists(SD_PATH, "homberbg.db") = True) Then
      ToastMessageShow("Doesn't exist......" & SD_PATH & "homberbg.db", True)
      Log("DB exists......" & SD_PATH & "homberbg.db")
      FillLangScrollView
   
   Else
      ToastMessageShow("Creating............." & SD_PATH & "homberbg.db", True)
   
   CreateSystemTable
   InsertDefaults
   CreateDictionTable
   'FetchDictionList
   CreateMenuTable
   FetchMenuList
   CreateLangTable
   Log("Going for langs")
   FetchImages ' Download all required images at once
   'FetchLangList
   End If

      
End Sub

I have tried reversing the code to check if the file exists = false which didn't work and also true. It doesn't work?

Any ideas please?

Malky
 

Attachments

  • path problem.zip
    19.8 KB · Views: 175
Last edited:

NJDude

Expert
Licensed User
Longtime User
I haven't downloaded your code but look at this message:
B4X:
...
    If (File.Exists(SD_PATH, "homberbg.db") = True) Then
        ToastMessageShow("Doesn't exist......" & SD_PATH & "homberbg.db", True)
        Log("DB exists......" & SD_PATH & "homberbg.db")        FillLangScrollView
     Else

...

You are asking if EXISTS and if it does the ToastMessage shows "DOESN'T", I think you have those prompts wrong.
 
Upvote 0

Malky

Active Member
Licensed User
Longtime User
Hi, please ignore the toast message, I only changed the log message as the exists - false didn't work, (which should), so I swapped the code in the if/else statements and tested for true.

It is irrelevant.

Cheers,

Malky
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
The spelling is not correct: In the Initialize line you use: "homerbg.db" and in the File.Exists line you use: "homberbg.db"
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Take a close look at the spelling of the name of the database. It is different in both lines: The below is your code you posted:
B4X:
SQL1.Initialize(SD_PATH, "homerbg.db", True)

B4X:
If (File.Exists(SD_PATH, "homberbg.db") = True) Then
 
Upvote 0

Malky

Active Member
Licensed User
Longtime User
I have searched my code for "homb" and it doesn't exist, can you kindly state the line it is on?

Malky
 
Upvote 0

Malky

Active Member
Licensed User
Longtime User
Apologies, I am now referring to a more recent post from tonight, saw the email and clicked on the forum link thinking it was connected to the new post.

Thought I was losing it there :)

Malky
:sign0013:
 
Upvote 0
Top