Hello,

I have an application which starts with a login, but at the same time also a selection of the folder for (native) database files used by the program.
And hope somebody can guide me to the best way to achieve this.

Instead of using the config.ws (or multiple .ws files) I prefer to use an .ini file (class cIniFile) to store the paths for last selected folders.
The .ini file is located in same folder as the application .Exe file.

My though was to do this (in object creation sequence) and before any datafiles are opened:
oApplication (based on cApplication)

oInifile (based on cInifile)
-> Set the psFilename of oIniFile to GetApplicationPath of oApplication + IniFile.Ini

Then I have procedure to:
ReadString "DataPaths" "LastUsed" of oIniFile to sDataPath
Set psDataPath of phoWorkspace of oApplication to sDataPath
Set psFilelist of phoWorkspace of oApplication to sDataPath + fielist.cfg

This does set the values of psDataPath and psFilelist in of the workspace to the folders read from IniFile
BUT when opening datafiles it is not the ones that I expect, but the ones defined in the Config.ws datapath.
Could it be that once the workspace object is created I may change these properties, but is has no effect?

I did try to switch object creation sequence so that oIniFile comes before oApplication, but without using the getApplicationPath of oApplication I cannot be sure that the IniFile.Ini is found.
(depends on how program is started: from Studio, shortcut etc.)

I see 3 possible solutions (but none of them I would know how to implement):
1) Define oIniFile before oApplication, but use an alternative way than getApplicationPath to make sure it is located, i Just dont know how.
2) Define oApplication before oIniFile but find another way to tell DF which datafolder to use than through the psDataPath/psFilelist properties of oWorkspace
3) Or any another way to make the datapath defined in IniFile.ini known and put into the psDataPath of the oWorkspace before it is too late.

All guidance is appreciated, thanks
Carsten