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:
parent
01ace95c32
commit
2eea9b913c
36
Utils.py
36
Utils.py
|
@ -82,38 +82,10 @@ local_path.cached_path = None
|
||||||
def output_path(path):
|
def output_path(path):
|
||||||
if output_path.cached_path:
|
if output_path.cached_path:
|
||||||
return os.path.join(output_path.cached_path, path)
|
return os.path.join(output_path.cached_path, path)
|
||||||
|
output_path.cached_path = local_path(os.path.join("output", path))
|
||||||
if not is_bundled() and not hasattr(sys, "_MEIPASS"):
|
path = os.path.join(output_path.cached_path, path)
|
||||||
# this should trigger if it's cx_freeze bundling
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||||
output_path.cached_path = '.'
|
return 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 = None
|
output_path.cached_path = None
|
||||||
|
|
||||||
|
|
|
@ -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, however, note that there is currently no way to supply names for teams 2+ through MultiMystery
|
||||||
teams: 1
|
teams: 1
|
||||||
#Where to place the resulting files
|
#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
|
#location of your Enemizer CLI, available here: https://github.com/Bonta0/Enemizer/releases
|
||||||
enemizer_path: "EnemizerCLI/EnemizerCLI.Core.exe"
|
enemizer_path: "EnemizerCLI/EnemizerCLI.Core.exe"
|
||||||
#folder from which the player yaml files are pulled from
|
#folder from which the player yaml files are pulled from
|
||||||
|
|
Loading…
Reference in New Issue