mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-26 02:05:09 +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)
|
||||
{
|
||||
if (filename.includes('/models/stable-diffusion/') || filename.includes('\\models\\stable-diffusion\\')) {
|
||||
let pathIdx = filename.lastIndexOf('/') // Linux, Mac paths
|
||||
if (pathIdx < 0) {
|
||||
pathIdx = filename.lastIndexOf('\\') // Windows paths.
|
||||
}
|
||||
if (pathIdx >= 0) {
|
||||
filename = filename.slice(pathIdx + 1)
|
||||
}
|
||||
let pathIdx
|
||||
if (filename.includes('/models/stable-diffusion/')) {
|
||||
pathIdx = filename.indexOf('/models/stable-diffusion/') + 25 // Linux, Mac paths
|
||||
}
|
||||
else if (filename.includes('\\models\\stable-diffusion\\')) {
|
||||
pathIdx = filename.indexOf('\\models\\stable-diffusion\\') + 25 // Linux, Mac paths
|
||||
}
|
||||
if (pathIdx >= 0) {
|
||||
filename = filename.slice(pathIdx)
|
||||
}
|
||||
extensions.forEach(ext => {
|
||||
if (filename.endsWith(ext)) {
|
||||
|
Loading…
Reference in New Issue
Block a user