import os def default_outdir(): if os.name == "nt": base = os.environ.get("LOCALAPPDATA") or os.path.expanduser(os.path.join("~", "AppData", "Local")) else: base = os.environ.get("XDG_DATA_HOME") or os.path.expanduser(os.path.join("~", ".local", "share")) return os.path.join(base, "php2shell", "out") def ensure(): path = default_outdir() os.makedirs(path, exist_ok=True) return path