From 0d0f17bdb74cbd0327701197cbec31cdfccf0390 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 15 Sep 2021 19:21:53 -0500 Subject: [PATCH] Adding configuration file. --- repository/TiddlyWiki/TiddlyWiki.class.st | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index cdadec1..e4151d3 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -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 |