Set the relative path of database connection

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Set the relative path of database connection

Post by AlessioForconi » Sun Feb 15, 2015 3:02 pm

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Set the relative path of database connection

Post by jmburnod » Mon Feb 16, 2015 1:04 pm

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
https://alternatic.ch

Post Reply

Return to “Mac OS”