Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issues when webui_dir is not work_dir #13210

Merged
merged 2 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ def check_python_version():
@lru_cache()
def commit_hash():
try:
return subprocess.check_output([git, "rev-parse", "HEAD"], shell=False, encoding='utf8').strip()
return subprocess.check_output([git, "-C", script_path, "rev-parse", "HEAD"], shell=False, encoding='utf8').strip()
except Exception:
return "<none>"


@lru_cache()
def git_tag():
try:
return subprocess.check_output([git, "describe", "--tags"], shell=False, encoding='utf8').strip()
return subprocess.check_output([git, "-C", script_path, "describe", "--tags"], shell=False, encoding='utf8').strip()
except Exception:
try:

Expand Down
2 changes: 1 addition & 1 deletion modules/paths.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import sys
from modules.paths_internal import models_path, script_path, data_path, extensions_dir, extensions_builtin_dir # noqa: F401
from modules.paths_internal import models_path, script_path, data_path, extensions_dir, extensions_builtin_dir, cwd # noqa: F401

import modules.safe # noqa: F401

Expand Down
1 change: 1 addition & 0 deletions modules/paths_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
commandline_args = os.environ.get('COMMANDLINE_ARGS', "")
sys.argv += shlex.split(commandline_args)

cwd = os.getcwd()
modules_path = os.path.dirname(os.path.realpath(__file__))
script_path = os.path.dirname(modules_path)

Expand Down
6 changes: 3 additions & 3 deletions modules/ui_gradio_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import gradio as gr

from modules import localization, shared, scripts
from modules.paths import script_path, data_path
from modules.paths import script_path, data_path, cwd


def webpath(fn):
if fn.startswith(script_path):
web_path = os.path.relpath(fn, script_path).replace('\\', '/')
if fn.startswith(cwd):
web_path = os.path.relpath(fn, cwd)
else:
web_path = os.path.abspath(fn)

Expand Down