Skip to content

Commit 5b761b4

Browse files
committed
correct webpath when webui_dir is not work_dir
1 parent 6fb2194 commit 5b761b4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

modules/paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import sys
3-
from modules.paths_internal import models_path, script_path, data_path, extensions_dir, extensions_builtin_dir # noqa: F401
3+
from modules.paths_internal import models_path, script_path, data_path, extensions_dir, extensions_builtin_dir, cwd # noqa: F401
44

55
import modules.safe # noqa: F401
66

modules/paths_internal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
commandline_args = os.environ.get('COMMANDLINE_ARGS', "")
99
sys.argv += shlex.split(commandline_args)
1010

11+
cwd = os.getcwd()
1112
modules_path = os.path.dirname(os.path.realpath(__file__))
1213
script_path = os.path.dirname(modules_path)
1314

modules/ui_gradio_extensions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
import gradio as gr
33

44
from modules import localization, shared, scripts
5-
from modules.paths import script_path, data_path
5+
from modules.paths import script_path, data_path, cwd
66

77

88
def webpath(fn):
9-
if fn.startswith(script_path):
10-
web_path = os.path.relpath(fn, script_path).replace('\\', '/')
9+
if fn.startswith(cwd):
10+
web_path = os.path.relpath(fn, cwd)
1111
else:
1212
web_path = os.path.abspath(fn)
1313

0 commit comments

Comments
 (0)