Page 1 of 1

Set the relative path of database connection

Posted: Sun Feb 15, 2015 3:02 pm
by AlessioForconi
Hello everyone
are a beginner with LiveCode, use the version 7.01 on Yosemite, and I'm trying to create a application to connect to an SQLite database.
How can you do to set the path of connection because it is relative and not absolute?
The database is located in the same folder as the application, and if I were to move I should change the path, I would like the database was searched in the folder wherever it is placed.

Thank You

Re: Set the relative path of database connection

Posted: Mon Feb 16, 2015 1:04 pm
by jmburnod
Hi Alessio,
This script return the path of the subfolder called "myFolder"

Code: Select all

on mouseUp
   put getMyPathFolder() & "/" & "myFolder" into tMyfolderpath
   put tMyfolderpath
end mouseUp

function getMyPathFolder
   put the effective filename of this stack into rgetMyPathFolder
   set the itemdel to "/"
   if the environment = "development" then
  delete  item-1 of rgetMyPathFolder
   else -- StandAlone mode. 
      if the platform = "MacOS" then 
         deleteĀ  item -4 to -1 of rgetMyPathFolder 
      else 
         delete  item-1 of rgetMyPathFolder 
      end if 
   end if	
      set the itemdel to ","
   return rgetMyPathFolder
end getMyPathFolder
Best regards
Jean-Marc