Skip to content

Commit

Permalink
fixed webapp issues
Browse files Browse the repository at this point in the history
  • Loading branch information
KitCat962 committed Mar 11, 2024
1 parent 3420b17 commit eee4b02
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions plugins/figura_format/figura_format.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
Expand Down

0 comments on commit eee4b02

Please sign in to comment.