|
Class: PersistentFileHistory
Object
|
+--PersistentFileHistory
- Package:
- stx:libbasic2
- Category:
- Interface-Framework
- Version:
- rev:
1.11
date: 2022/10/19 14:50:48
- user: cg
- file: PersistentFileHistory.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
Support code to provide a common access layer for persistent storage for applications.
For example, a persistent history of previously opened files.
On Windows systems, this is stored in the registry.
On Unix systems, it is stored in the user's home folder under '.smalltalk/registry/...'.
Both registry and directory use the same hierarchical structure.
The name and parent folder can be configured.
PersistentFileHistory new
applicationKey:'GDBApplication';
fileHistory
copyrightCOPYRIGHT (c) 2019 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
instance creation
-
new
-
return an initialized instance
-
newForApplicationKey: applicationKey
-
return an initialized instance
-
newForClass: anApplicationClass
-
return an initialized instance
accessing - configuration
-
applicationKey: aStringOrNil
-
this is used as the key under which the application's values are stored.
In the registry, this is the last key above the history entry);
if files are used, this is the folder name above which history, and other files are stored.
By default, the name of the application without prefix is used.
If nil, the data is stored right under the topDirectory/topRegistryKey
-
fileHistorySize
-
returns the max. number of remembered files in the history
-
fileHistorySizeLimit: anInteger
-
set the max. number of entries stored in the history.
Defaults to 25 if never explicitly changed
-
topDirectoryName: topKeyName
-
the directory under the home directory, where the history is made persistent.
Defaults to '.smalltalk',
but can be changed to eg. '.expecco'.
-
topRegistryKeyName: topKeyName
-
the key in the Windows Registry, where the history is made persistent.
Defaults to 'SmalltalkX',
but can be changed to eg. 'Expecco'.
accessing - file history
-
addToFileHistory: aFilename
-
remember a filename in the file history
-
do: aBlock
-
enumerate files in the file history;
Save to add or remove items while enumerating
-
fileHistory
-
return the file history
-
fileHistoryFilteredForStillExistingFilesDo: aBlock removeNonExisting: aBoolean
-
remove all non-existing history entries
-
first
-
-
remove: aFilename
-
remove a filename from the file history
-
removeAll
-
remove a filename from the file history
initialization
-
initialize
-
topDirectoryName can be set to eg '.expecco';
topRegistryKeyName to eg. Éxpecco'
see comments there.
private
-
directoryForFileHistory
-
the filename where the history is made persistent.
This depends on the owningApplication which should not be nil.
Usage example(s):
self new directoryForFileHistory => UnixFilename('/Users/exept/.smalltalk')
|
Usage example(s):
(self new topDirectoryName:'.expecco')
directoryForFileHistory => UnixFilename('/Users/exept/.expecco')
|
Usage example(s):
((self new topDirectoryName:'.expecco') applicationKey:'Foo')
directoryForFileHistory => UnixFilename('/Users/exept/.expecco/Foo')
|
-
fetchFileHistoryFromPersistentStore
-
-
initializeFileHistory
-
-
makeFileHistoryPersistent
-
private:
should be called in a synchronized region to protect fileHistory
from changes while being written
-
registryKeyForApplication
-
HKEY_CURRENT_USER\Software\Exept\SmalltalkX\<appname>
Usage example(s):
self registryKeyForApplication
|
-
registryKeyForFileHistory
-
HKEY_CURRENT_USER\Software\Exept\SmalltalkX\<appName>\History
Usage example(s):
self registryKeyForFileHistory
|
-
topDirectory
-
the filename where persistent files are stored.
Usage example(s):
queries
-
isEmpty
-
true if there is no history (yet)
-
isEmptyOrNil
-
true if there is no history (yet)
-
notEmpty
-
true if there is some history
-
notEmptyOrNil
-
true if there is some history
-
size
-
return the number of entries in the history
|