mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-26 10:16:12 +01:00
More robust relative path calculation
This commit is contained in:
parent
01368ac496
commit
a0178e15b3
@ -363,14 +363,15 @@ function readUI() {
|
|||||||
}
|
}
|
||||||
function getModelPath(filename, extensions)
|
function getModelPath(filename, extensions)
|
||||||
{
|
{
|
||||||
if (filename.includes('/models/stable-diffusion/') || filename.includes('\\models\\stable-diffusion\\')) {
|
let pathIdx
|
||||||
let pathIdx = filename.lastIndexOf('/') // Linux, Mac paths
|
if (filename.includes('/models/stable-diffusion/')) {
|
||||||
if (pathIdx < 0) {
|
pathIdx = filename.indexOf('/models/stable-diffusion/') + 25 // Linux, Mac paths
|
||||||
pathIdx = filename.lastIndexOf('\\') // Windows paths.
|
}
|
||||||
|
else if (filename.includes('\\models\\stable-diffusion\\')) {
|
||||||
|
pathIdx = filename.indexOf('\\models\\stable-diffusion\\') + 25 // Linux, Mac paths
|
||||||
}
|
}
|
||||||
if (pathIdx >= 0) {
|
if (pathIdx >= 0) {
|
||||||
filename = filename.slice(pathIdx + 1)
|
filename = filename.slice(pathIdx)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
extensions.forEach(ext => {
|
extensions.forEach(ext => {
|
||||||
if (filename.endsWith(ext)) {
|
if (filename.endsWith(ext)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user