mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-03-09 23:44:55 +08:00
webpath use truncate_path
This commit is contained in:
parent
af2951ed53
commit
892e703b59
@ -1,17 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
import gradio as gr
|
import gradio as gr
|
||||||
|
|
||||||
from modules import localization, shared, scripts
|
from modules import localization, shared, scripts, util
|
||||||
from modules.paths import script_path, data_path, cwd
|
from modules.paths import script_path, data_path
|
||||||
|
|
||||||
|
|
||||||
def webpath(fn):
|
def webpath(fn):
|
||||||
if fn.startswith(cwd):
|
return f'file={util.truncate_path(fn)}?{os.path.getmtime(fn)}'
|
||||||
web_path = os.path.relpath(fn, cwd)
|
|
||||||
else:
|
|
||||||
web_path = os.path.abspath(fn)
|
|
||||||
|
|
||||||
return f'file={web_path}?{os.path.getmtime(fn)}'
|
|
||||||
|
|
||||||
|
|
||||||
def javascript_html():
|
def javascript_html():
|
||||||
|
Loading…
Reference in New Issue
Block a user