FLTK logo

[fltk.general] Adding method to get prefs file path without Fl_Preferences constructor

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Adding method to get prefs file path without Fl_Preferences constructor "anmol.... Apr 30, 2021  
 
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.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/be9dcc6d-e982-415c-9e78-20faf416bc6bn%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.