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
Set the relative path of database connection
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 90
- Joined: Sun Feb 15, 2015 2:51 pm
-
- 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
Hi Alessio,
This script return the path of the subfolder called "myFolder"
Best regards
Jean-Marc
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
Jean-Marc
https://alternatic.ch