Adding method to get prefs file path without Fl_Preferences constructor

7 views
Skip to first unread message

anmol....@gmail.com

unread,
Apr 30, 2021, 1:33:37 PM4/30/21
to fltk.general

I am reposting this as it was previously posted in a thread from 2015.
I am trying to keep a default prefs file as a string within my app (this is necessary as I am using prefs to store encrypted data), and when the user runs the app, I would like to detect if a file was created, and if not, copy over the contained file.

For this, I need to know the prefs path before invoking the Fl_Preferences constructor as the constructor itself creates an empty file.

So far, from Fl_Preferences.cxx, I found that the system_driver preference_rootnode method creates the filename.
Fl::system_driver()->preference_rootnode(prefs, root, vendor, application);

This is a virtual function that is defined based on the platform, hence I cannot simply copy the code from inside it.

Could I request the developers to expose a method from within Fl_Preferences that will simply return the generated filename if <root> <vendor> and <application> were to be passed as the constructor arguments ?

Perhaps

char * Fl_Preferences::location (Root root, const char *vendor, const char *application)

This would not modify any private vars inside Fl_Preferences. The return buffer can be freed by the user.
Reply all
Reply to author
Forward
0 new messages