Scripts: every script label in a Scripts folder level stays distinct

A script renamed to its whole file name could take the label another
script kept, as with tidy.js, tidy.jsx and tidy.js.js in one folder.
The rename now repeats until no label is shared. A folder entry whose
type cannot be read now marks the listing as incomplete.
This commit is contained in:
dotCooCoo
2026-11-10 18:48:59 -08:00
parent ea9b93d3ce
commit a06ab45911
2 changed files with 29 additions and 13 deletions
+3 -2
View File
@@ -77,10 +77,11 @@ fn scripts_and_subfolders_are_listed_by_name_without_the_extension() {
fn a_script_whose_label_another_row_has_shows_its_whole_file_name() {
let dir = folder("same");
let root = dir.join("Scripts");
for name in ["tidy.js", "tidy.jsx", "tidy/x.js", "alone.jsx"] {
for name in ["tidy.js", "tidy.jsx", "tidy.js.js", "tidy/x.js", "alone.jsx"] {
touch(&root, name);
}
assert_eq!(rows(&folder::list(&root).entries), "alone, tidy/[x], tidy.js, tidy.jsx");
// `tidy.js.js` is labeled `tidy.js` until `tidy.js` takes that label, then shows its whole name.
assert_eq!(rows(&folder::list(&root).entries), "alone, tidy/[x], tidy.js, tidy.js.js, tidy.jsx");
let _ = std::fs::remove_dir_all(dir);
}