Implementing FileLocator aliases, so data narratives can use them instead of fixed locations.
This commit is contained in:
parent
f592e29eef
commit
31e27acdff
29
src/MiniDocs/FileLocator.extension.st
Normal file
29
src/MiniDocs/FileLocator.extension.st
Normal file
@ -0,0 +1,29 @@
|
||||
Extension { #name : #FileLocator }
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
FileLocator class >> aliases [
|
||||
| fileAliases |
|
||||
fileAliases := self fileAliases.
|
||||
fileAliases exists
|
||||
ifFalse: [ | initialConfig |
|
||||
initialConfig := Dictionary new.
|
||||
fileAliases ensureCreateFile.
|
||||
MarkupFile exportAsFileOn: fileAliases containing: initialConfig
|
||||
].
|
||||
^ STON fromString: fileAliases contents
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
FileLocator class >> atAlias: aString put: aFolderOrFile [
|
||||
| updatedAliases |
|
||||
updatedAliases:= self aliases
|
||||
at: aString put: aFolderOrFile;
|
||||
yourself.
|
||||
MarkupFile exportAsFileOn: self fileAliases containing: updatedAliases.
|
||||
^ updatedAliases
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
FileLocator class >> fileAliases [
|
||||
^ MiniDocs appFolder / 'fileAliases.ston'
|
||||
]
|
Loading…
Reference in New Issue
Block a user