mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-08 13:19:54 +00:00
correct webpath when webui_dir is not work_dir
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
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
|
import modules.safe # noqa: F401
|
||||||
|
|
||||||
|
@@ -8,6 +8,7 @@ import shlex
|
|||||||
commandline_args = os.environ.get('COMMANDLINE_ARGS', "")
|
commandline_args = os.environ.get('COMMANDLINE_ARGS', "")
|
||||||
sys.argv += shlex.split(commandline_args)
|
sys.argv += shlex.split(commandline_args)
|
||||||
|
|
||||||
|
cwd = os.getcwd()
|
||||||
modules_path = os.path.dirname(os.path.realpath(__file__))
|
modules_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
script_path = os.path.dirname(modules_path)
|
script_path = os.path.dirname(modules_path)
|
||||||
|
|
||||||
|
@@ -2,12 +2,12 @@ import os
|
|||||||
import gradio as gr
|
import gradio as gr
|
||||||
|
|
||||||
from modules import localization, shared, scripts
|
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):
|
def webpath(fn):
|
||||||
if fn.startswith(script_path):
|
if fn.startswith(cwd):
|
||||||
web_path = os.path.relpath(fn, script_path).replace('\\', '/')
|
web_path = os.path.relpath(fn, cwd)
|
||||||
else:
|
else:
|
||||||
web_path = os.path.abspath(fn)
|
web_path = os.path.abspath(fn)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user