From: Jeremy Stanley Date: Sun, 30 Jul 2017 02:40:25 +0000 (+0000) Subject: Rename internal:storage to .mudpy.filing X-Git-Tag: 0.0.1~143 X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=355edb2439b561811a4f376db6dc9d05a4a01735;hp=3716a4cf43e0be2811dc8aeb0603f99209c42757 Rename internal:storage to .mudpy.filing Convert the old style internal:storage element to a new style .mudpy.filing element and adjust the find_file() function accordingly. --- diff --git a/etc/mudpy.yaml b/etc/mudpy.yaml index a531af3..482666f 100644 --- a/etc/mudpy.yaml +++ b/etc/mudpy.yaml @@ -9,6 +9,10 @@ __control__: private_files: [ "account.yaml" ] read_only: yes +.mudpy.filing.prefix: "." +.mudpy.filing.search: [ "", "etc", "share", "data" ] +.mudpy.filing.stash: "data" + .mudpy.linguistic.actions: { "?": "ask", ",": "begin", "-": "begin", ":": "begin", ";": "begin", "!": "exclaim", "...": "muse", ".": "say" } .mudpy.linguistic.default_punctuation: . .mudpy.linguistic.typos: { "i": "I", "i'd": "I'd", "i'll": "I'll", "i'm": "I'm", "teh": "the", "theyre": "they're", "youre": "you're" } @@ -57,8 +61,3 @@ __control__: .mudpy.timing.increment: 0.1 .mudpy.timing.save: 600 .mudpy.timing.status: 6000 - -internal:storage: - default_dir: "data" - root_path: "." - search_path: [ "", "etc", "share", "data" ] diff --git a/mudpy/data.py b/mudpy/data.py index 0483cd7..74d2da8 100644 --- a/mudpy/data.py +++ b/mudpy/data.py @@ -193,10 +193,10 @@ class DataFile: def find_file( file_name=None, - root_path=None, - search_path=None, - default_dir=None, + prefix=None, relative=None, + search=None, + stash=None, universe=None ): """Return an absolute file path based on configuration.""" @@ -209,16 +209,14 @@ def find_file( if universe: if hasattr( - universe, - "contents" - ) and "internal:storage" in universe.contents: - storage = universe.categories["internal"]["storage"] - if not root_path: - root_path = storage.get("root_path") - if not search_path: - search_path = storage.get("search_path") - if not default_dir: - default_dir = storage.get("default_dir") + universe, "contents") and "mudpy.filing" in universe.contents: + filing = universe.contents["mudpy.filing"] + if not prefix: + prefix = filing.get("prefix") + if not search: + search = filing.get("search") + if not stash: + stash = filing.get("stash") # if there's only one file loaded, try to work around a chicken