default to outputting to {local_path}/output

* Windows setup has that path as writable by everyone
* most others run from source, where the entire source path and children is writable.
* People complained about files appearing in My Documents, which admittedly is not intuitive
This commit is contained in:
Fabian Dill 2020-08-01 16:52:11 +02:00
parent 01ace95c32
commit 2eea9b913c
2 changed files with 5 additions and 33 deletions

View File

@ -82,38 +82,10 @@ local_path.cached_path = None
def output_path(path):
if output_path.cached_path:
return os.path.join(output_path.cached_path, path)
if not is_bundled() and not hasattr(sys, "_MEIPASS"):
# this should trigger if it's cx_freeze bundling
output_path.cached_path = '.'
return os.path.join(output_path.cached_path, path)
else:
# has been PyInstaller packaged, so cannot use CWD for output.
if sys.platform == 'win32':
# windows
import ctypes.wintypes
CSIDL_PERSONAL = 5 # My Documents
SHGFP_TYPE_CURRENT = 0 # Get current, not default value
buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
ctypes.windll.shell32.SHGetFolderPathW(None, CSIDL_PERSONAL, None, SHGFP_TYPE_CURRENT, buf)
documents = buf.value
elif sys.platform == 'darwin':
from AppKit import NSSearchPathForDirectoriesInDomains # pylint: disable=import-error
# http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
NSDocumentDirectory = 9
NSUserDomainMask = 1
# True for expanding the tilde into a fully qualified path
documents = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, True)[0]
else:
raise NotImplementedError('Not supported yet')
output_path.cached_path = os.path.join(documents, 'ALttPEntranceRandomizer')
if not os.path.exists(output_path.cached_path):
os.mkdir(output_path.cached_path)
return os.path.join(output_path.cached_path, path)
output_path.cached_path = local_path(os.path.join("output", path))
path = os.path.join(output_path.cached_path, path)
os.makedirs(os.path.dirname(path), exist_ok=True)
return path
output_path.cached_path = None

View File

@ -50,7 +50,7 @@ multi_mystery_options:
#teams, however, note that there is currently no way to supply names for teams 2+ through MultiMystery
teams: 1
#Where to place the resulting files
output_path: "MultiMystery"
output_path: "output"
#location of your Enemizer CLI, available here: https://github.com/Bonta0/Enemizer/releases
enemizer_path: "EnemizerCLI/EnemizerCLI.Core.exe"
#folder from which the player yaml files are pulled from