FLTK logo

[fltk/fltk] New method to return Fl_Preferences location without invoking constructor (#227)

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.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

[fltk/fltk] New method to return Fl_Preferences location without invoking constructor (#227) zcream Apr 30, 2021  
 

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 and 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 are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

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'.