Adding configuration file.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-09-15 19:21:53 -05:00
parent d8f4888aa7
commit 0d0f17bdb7

View File

@ -16,6 +16,30 @@ Class {
#category : 'TiddlyWiki-Model'
}
{ #category : 'accessing' }
TiddlyWiki >> addToConfigFile [
| configDict cleaned |
configDict := STONJSON fromString: self configFile contents.
cleaned := self copy.
cleaned tiddlers: nil.
configDict
at: cleaned name put: cleaned;
yourself.
MarkupFile exportAsFileOn: self configFile containing:(STON toStringPretty: configDict)
]
{ #category : 'accessing' }
TiddlyWiki >> configFile [
| tempFile |
tempFile := FileLocator home / '.config' / 'TiddlyWikiPharo' / 'tiddlywiki.conf.ston'.
tempFile ensureCreateFile.
tempFile contents isEmpty ifTrue: [
MarkupFile exportAsFileOn: tempFile containing: ( STON toStringPretty: Dictionary new)
].
^ tempFile
]
{ #category : 'accessing' }
TiddlyWiki >> exportSTONFile [
| stonFile output |