Q1 Resolved. Thanks very much Gianluigi. The suggestion to copy from install path to home directory worked (Note : not move .. move needs SUDO)
Dim InstPath As String = "/opt/.stnDB" ' This is where package gets installed
Dim ExecPath As String = User.Home &/ ".stnDB" ' This is where installed package will be moved on 1st run
If Exist(ExecPath) Then
Initialize_application ' All fine , run the code
Else If Exist(InstPath)
Shell Subst("cp &1 &2 ", InstPath, ExecPath) Wait ' 1st time run , move DB to User.home
Initialize_application
Else
' Trouble my DB not found where it ought to be !
Message.Title = "Fatal Error"
Message.Error("Database file not found, Exit.")
Quit
End If
Hi Ujlain,
I apologise for the delay in the reply.
Generally in a Gambas application we have an MMain.module and an FMain.class etc.
The application starts from MMain, sub main creates the conditions and opens the FMain.
FMain is normally set as Application.MainWindow = Me so that when you close FMain you close the entire application.
You could use Mkdir (http://gambaswiki.org/wiki/lang/mkdir) to create the directories e.g.:
Private $sPath As String = User.Home &/ "." & Application.Name
If Not Exist($sPath) Then
Mkdir $sPath
Mkdir $sPath &/ "database"
Endif
And use Copy (http://gambaswiki.org/wiki/lang/copy) to copy the database from the Data folder to $sPath e.g.:
Copy "./MyDat.sqlite3" To $sPath &/ "database/MyDat.sqlite3"
:ciao: :ciao: