=over 4
-=item B<storable_file>: I<E<lt>fileE<gt>>
+=item B<storage_file>: "I<storage.dat>";
-Sets the file to use for storable.
+Sets the file storable will write it's data to.
+
+=item B<storage_dir>: "I<var/>";
+
+Sets the directory in which B<storage_file> can be found.
=back
=cut
-our $StorableFile = get_config ('storable_file') || 'persistency.dat';
+our $StorageFile = get_config ('storage_file') || 'storage.dat';
+our $StorageDir = 'var';
+if (get_config ('storage_dir'))
+{
+ $StorageDir = get_config ('storage_dir');
+}
+elsif ($ENV{'HOME'})
+{
+ $StorageDir = $ENV{'HOME'} . '/.onis/data';
+}
+$StorageDir =~ s#/+$##;
+
+if (!-d $StorageDir)
+{
+ print STDERR $/, __FILE__, ':', <<ERROR;
+
+``storage_dir'' is set to ``$StorageDir'', but the directory doesn't exist or
+isn't a directory. Please fix it..
+
+ERROR
+ exit (1);
+}
-if (-f $StorableFile)
+if (-f "$StorageDir/$StorageFile")
{
- $TREE = retrieve ($StorableFile);
+ $TREE = retrieve ("$StorageDir/$StorageFile");
}
if ($::DEBUG & 0x0200)
END
{
- store ($TREE, $StorableFile);
+ store ($TREE, "$StorageDir/$StorageFile");
}
=head1 AUTHOR