Skip to content

Commit

Permalink
correct webpath when webui_dir is not work_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
w-e-w committed Sep 13, 2023
1 parent 6fb2194 commit 5b761b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
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

0 comments on commit 5b761b4

Please sign in to comment.