@gallop.software/studio 2.3.147 → 2.3.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.js +24 -2
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -4742,10 +4742,14 @@ async function handleFontsRename(request) {
|
|
|
4742
4742
|
}
|
|
4743
4743
|
const oldFullPath = getWorkspacePath(oldPath);
|
|
4744
4744
|
const parentDir = path11.dirname(oldPath);
|
|
4745
|
-
const
|
|
4745
|
+
const oldFolderName = path11.basename(oldPath).toLowerCase();
|
|
4746
|
+
const newFolderName = newName.toLowerCase();
|
|
4747
|
+
const newPath = `${parentDir}/${newFolderName}`;
|
|
4746
4748
|
const newFullPath = getWorkspacePath(newPath);
|
|
4749
|
+
let isDirectory = false;
|
|
4747
4750
|
try {
|
|
4748
|
-
await fs12.stat(oldFullPath);
|
|
4751
|
+
const stat = await fs12.stat(oldFullPath);
|
|
4752
|
+
isDirectory = stat.isDirectory();
|
|
4749
4753
|
} catch {
|
|
4750
4754
|
return jsonResponse({ error: "Path not found" }, { status: 404 });
|
|
4751
4755
|
}
|
|
@@ -4755,6 +4759,24 @@ async function handleFontsRename(request) {
|
|
|
4755
4759
|
} catch {
|
|
4756
4760
|
}
|
|
4757
4761
|
await fs12.rename(oldFullPath, newFullPath);
|
|
4762
|
+
if (isDirectory) {
|
|
4763
|
+
try {
|
|
4764
|
+
const entries = await fs12.readdir(newFullPath);
|
|
4765
|
+
for (const entry of entries) {
|
|
4766
|
+
const entryLower = entry.toLowerCase();
|
|
4767
|
+
if (entryLower.startsWith(oldFolderName + "-") || entryLower.startsWith(oldFolderName + "_")) {
|
|
4768
|
+
const separator = entryLower.startsWith(oldFolderName + "-") ? "-" : "_";
|
|
4769
|
+
const suffix = entry.substring(oldFolderName.length);
|
|
4770
|
+
const newFileName = newFolderName + suffix.toLowerCase();
|
|
4771
|
+
const oldFilePath = path11.join(newFullPath, entry);
|
|
4772
|
+
const newFilePath = path11.join(newFullPath, newFileName);
|
|
4773
|
+
await fs12.rename(oldFilePath, newFilePath);
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
} catch (err) {
|
|
4777
|
+
console.error("Error renaming files inside folder:", err);
|
|
4778
|
+
}
|
|
4779
|
+
}
|
|
4758
4780
|
return jsonResponse({
|
|
4759
4781
|
success: true,
|
|
4760
4782
|
oldPath,
|