Old model name in rename window prompt.
This commit is contained in:
@@ -1617,18 +1617,18 @@ class ModelInfoView {
|
|||||||
$el("button.icon-button", {
|
$el("button.icon-button", {
|
||||||
textContent: "✎",
|
textContent: "✎",
|
||||||
onclick: async(e) => {
|
onclick: async(e) => {
|
||||||
const name = window.prompt("New model name:");
|
const container = this.elements.info;
|
||||||
|
const oldFile = container.dataset.path;
|
||||||
|
const [oldFilePath, oldFileName] = SearchPath.split(oldFile);
|
||||||
|
const oldName = SearchPath.splitExtension(oldFileName)[0];
|
||||||
|
const newName = window.prompt("New model name:", oldName);
|
||||||
let renamed = false;
|
let renamed = false;
|
||||||
if (name !== null && name !== "") {
|
if (newName !== null && newName !== "" && newName != oldName) {
|
||||||
const container = this.elements.info;
|
|
||||||
const oldFile = container.dataset.path;
|
|
||||||
const [oldFilePath, oldFileName] = SearchPath.split(oldFile);
|
|
||||||
const [_, extension] = SearchPath.splitExtension(oldFile);
|
|
||||||
const newFile = (
|
const newFile = (
|
||||||
oldFilePath +
|
oldFilePath +
|
||||||
searchSeparator +
|
searchSeparator +
|
||||||
name +
|
newName +
|
||||||
extension
|
SearchPath.splitExtension(oldFile)[1]
|
||||||
);
|
);
|
||||||
renamed = await request(
|
renamed = await request(
|
||||||
`/model-manager/model/move`,
|
`/model-manager/model/move`,
|
||||||
|
|||||||
Reference in New Issue
Block a user