summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-08-27 03:03:37 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-08-27 03:03:37 +0000
commit047c32c334ae7b2534959a9dac8cc31647d1d630 (patch)
tree8e31e6b1b445023432d674d06b63298601694461 /src
parentcb27aab8a5b2a9dfa9b1441c2c1740e5314733f5 (diff)
Add constructors that accept the path to use (rather then SYSTEM or USER
locations) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2607 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Preferences.cxx34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index 12f7e4f45..0eb03d083 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Preferences.cxx,v 1.1.2.18 2002/08/09 01:09:49 easysw Exp $"
+// "$Id: Fl_Preferences.cxx,v 1.1.2.19 2002/08/27 03:03:37 easysw Exp $"
//
// Preferences methods for the Fast Light Tool Kit (FLTK).
//
@@ -66,6 +66,18 @@ Fl_Preferences::Fl_Preferences( Root root, const char *vendor, const char *appli
/**
+ * create the initial preferences base
+ * - path: an application-supplied path
+ * example: Fl_Preferences base( "/usr/foo" );
+ */
+Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char *application )
+{
+ node = new Node( "." );
+ rootNode = new RootNode( this, path, vendor, application );
+}
+
+
+/**
* create a Preferences node in relation to a parent node for reading and writing
* - parent: base name for group
* - group: group name (can contain '/' seperated group names)
@@ -669,6 +681,24 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
read();
}
+// create the root node
+// - construct the name of the file that will hold our preferences
+Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, const char *path, const char *vendor, const char *application )
+{
+ char filename[ FL_PATH_MAX ]; filename[0] = 0;
+
+ snprintf(filename, sizeof(filename), "%s/%s.prefs", path, application);
+
+ makePathForFile(filename);
+
+ prefs_ = prefs;
+ filename_ = strdup(filename);
+ vendor_ = strdup(vendor);
+ application_ = strdup(application);
+
+ read();
+}
+
// destroy the root node and all depending nodes
Fl_Preferences::RootNode::~RootNode()
{
@@ -1054,5 +1084,5 @@ char Fl_Preferences::Node::remove()
//
-// End of "$Id: Fl_Preferences.cxx,v 1.1.2.18 2002/08/09 01:09:49 easysw Exp $".
+// End of "$Id: Fl_Preferences.cxx,v 1.1.2.19 2002/08/27 03:03:37 easysw Exp $".
//