1. ATK Gimmy Susan
  2. PowerBuilder
  3. Monday, 13 May 2019 15:40 PM UTC
Good morning Guru
Our applications use an ini configuration file. eg: ProfileString ('app_lore', "stock", "0105", "S") Unfortunately, erroneously, in some cases there are more than one 'app_lore' file (in different folders). Is there a way to know which file was read by ProfileString (complete path)?


ty
Accepted Answer
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 14 May 2019 18:54 PM UTC
  2. PowerBuilder
  3. # Permalink

ProfileString ( filename, section, key, default )

ProfileString ('app_lore', "stock", "0105", "S")

 

At some point, your design must be changed. Decide which fix you will implement, code it, test it, QA it, then create a new build. Schedule time to replace the segments/PBDs or DLLs of code that need to be replaced.

In most cases, these segments can be replaced hot, i.e. while users are  in the application, and the changes will get picked up the next time the app is started.


Suggestions / ideas / options:

1) Read your INI file at start-up then store the data in one or more application caches.
    Use the cache(s) instead of the multiple INI files.

2) From what it looks like, the data in the "app_lore" section really needs to be in a table.
    If possible, move the data from the INI file into a table a RETRIEVE your data as needed.
    If not possible, come up was a way to distinguish between data segments and revise "app_lore" accordingly.

3) Offer the users an option to select & read the INI file they need with a GetFileOpenName.


Good Luck,

Olan

Comment
  1. Roland Smith
  2. Wednesday, 15 May 2019 00:17 AM UTC
I agree, using .ini files is poor design. Per user app settings should be in the registry and not contain any business data. The registry settings should be limited to stuff like saving the window position. There should be a generic settings table in the database.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 13 May 2019 19:38 PM UTC
  2. PowerBuilder
  3. # 1

You can always pass the full path name of the file if you want.

Comment
  1. ATK Gimmy Susan
  2. Tuesday, 14 May 2019 11:07 AM UTC
Unfortunately it is not possible.

The installation is already operational
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 13 May 2019 18:49 PM UTC
  2. PowerBuilder
  3. # 2

Hi Gimmy;

  FWIW: You can use the GetCurrentDirectory() command before the ProfileString to see what folder the INI would be coming from if it does not have an O/S "path" in the ProfileString/Int() command's 1st argument (like you seem to indicate).

Regards ... Chris

 

Comment
  1. ATK Gimmy Susan
  2. Tuesday, 14 May 2019 11:09 AM UTC
Unfortunately INI file is not in the exe folder
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 14 May 2019 15:37 PM UTC
Then a full path to the INI file would always be required. However, I would not trust the full path even in my PB apps. Try using a FileExists() command first before the ProfileString processing commences.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 13 May 2019 17:42 PM UTC
  2. PowerBuilder
  3. # 3

Not from the program. It will use the standard search that Windows uses for loading DLL files, current folder then folders in the path starting at the first one.

 

Comment
  1. Chris Pollach @Appeon
  2. Monday, 13 May 2019 19:31 PM UTC
Hi Roland ... that is true only if a) the INI is not local to the App's EXE and b) you did not provide a path. Then the O/S search would be as you stated.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.