From eee4b02316bb2f84581a92c210fcd5c9925b995d Mon Sep 17 00:00:00 2001 From: KitCat962 Date: Mon, 11 Mar 2024 13:52:02 -0400 Subject: [PATCH] fixed webapp issues --- plugins/figura_format/figura_format.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/figura_format/figura_format.js b/plugins/figura_format/figura_format.js index 12a7f072..9551b6b8 100644 --- a/plugins/figura_format/figura_format.js +++ b/plugins/figura_format/figura_format.js @@ -146,14 +146,18 @@ icon: "fa-clipboard", condition: () => Format === format && (Texture.selected !== null), click() { - let texture = PathModule.parse(Texture.selected.path) - let project = PathModule.parse(Project.save_path) - let relative = PathModule.relative(project.dir, texture.dir) let path - if (texture.dir == '' || relative.startsWith(`..`)) + if (!isApp) path = `textures["${Project.name}.${Texture.selected.name.replace(/\.png$/, "")}"]` - else - path = `textures["${relative.replace(`\\${PathModule.sep}`, '.')}${relative == '' ? '' : '.'}${texture.name}"]` + else { + let texture = PathModule.parse(Texture.selected.path) + let project = PathModule.parse(Project.save_path) + let relative = PathModule.relative(project.dir, texture.dir) + if (texture.dir == '' || relative.startsWith(`..`)) + path = `textures["${Project.name}.${Texture.selected.name.replace(/\.png$/, "")}"]` + else + path = `textures["${relative.replace(`\\${PathModule.sep}`, '.')}${relative == '' ? '' : '.'}${texture.name}"]` + } navigator.clipboard.writeText(path) Blockbench.showQuickMessage(`Coppied "${path}" to the clipboard`) }