X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=blobdiff_plain;f=mudpy%2Fdata.py;h=e9a10799d8fe793c0b6ecf44f13216bba7d1deda;hp=c4848be27c1cfd42c6f38c9af4f4d5645598768c;hb=11ae0d6e7e05cffb744f7b40f37309f07696d34a;hpb=275b3f156a8ceb0ec50e5651cbcb8415269c7dd4 diff --git a/mudpy/data.py b/mudpy/data.py index c4848be..e9a1079 100644 --- a/mudpy/data.py +++ b/mudpy/data.py @@ -1,6 +1,6 @@ """Data interface functions for the mudpy engine.""" -# Copyright (c) 2004-2016 Jeremy Stanley . Permission +# Copyright (c) 2004-2017 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. @@ -193,18 +193,14 @@ 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.""" - # make sure to get rid of any surrounding quotes first thing - if file_name: - file_name = file_name.strip("\"'") - # this is all unnecessary if it's already absolute if file_name and os.path.isabs(file_name): return os.path.realpath(file_name) @@ -213,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").strip("\"'") - if not search_path: - search_path = storage.get("search_path") - if not default_dir: - default_dir = storage.get("default_dir").strip("\"'") + 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