Skip to content

Commit bdfa82a

Browse files
committed
paint: browser fixes
1 parent d028010 commit bdfa82a

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

paint/sources/ui_files.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function ui_files_file_browser(handle: ui_handle_t, drag_files: bool = false, se
8181
let icons: gpu_texture_t = resource_get("icons.k");
8282
let folder: rect_t = resource_tile50(icons, icon_t.FOLDER_FULL);
8383
let file: rect_t = resource_tile50(icons, icon_t.FILE);
84+
let cube: rect_t = resource_tile50(icons, icon_t.CUBE);
8485
let downloading: rect_t = resource_tile50(icons, icon_t.DOWNLOADING);
8586
let is_cloud: bool = starts_with(handle.text, "cloud");
8687

@@ -116,13 +117,15 @@ function ui_files_file_browser(handle: ui_handle_t, drag_files: bool = false, se
116117

117118
for (let i: i32 = 0; i < files_all.length; ++i) {
118119
let f: string = files_all[i];
120+
let is_dir: bool = iron_is_directory(path_join(dir_path, f));
119121
if (f == "" || char_at(f, 0) == ".") {
120122
continue; // Skip hidden
121123
}
122-
if (!is_cloud && string_index_of(f, ".") > 0) {
123-
if (!iron_is_directory(path_join(dir_path, f)) && !path_is_known(f)) {
124-
continue; // Skip unknown extensions
125-
}
124+
if (!is_cloud && string_index_of(f, ".") > 0 && !is_dir && !path_is_known(f)) {
125+
continue; // Skip unknown extensions
126+
}
127+
if (!is_cloud && !is_dir && string_index_of(f, ".") == -1) {
128+
continue; // Skip files with no extension
126129
}
127130
if (is_cloud && string_index_of(f, "_icon.") >= 0) {
128131
continue; // Skip thumbnails
@@ -165,11 +168,22 @@ function ui_files_file_browser(handle: ui_handle_t, drag_files: bool = false, se
165168

166169
let f: string = ui_files_files[i];
167170
let _x: f32 = ui._x;
168-
let is_folder: bool = iron_is_directory(path_join(handle.text, f));
171+
let is_folder: bool;
172+
if (is_cloud) {
173+
is_folder = string_index_of(f, ".") == -1;
174+
}
175+
else {
176+
is_folder = iron_is_directory(path_join(handle.text, f));
177+
}
178+
169179
let rect: rect_t = is_folder ? folder : file;
170180
if (rect == file && is_cloud) {
171181
rect = downloading;
172182
}
183+
else if (!is_folder && path_is_mesh(f)) {
184+
rect = cube;
185+
}
186+
173187
let col: i32 = rect == file ? ui.ops.theme.LABEL_COL : ui.ops.theme.LABEL_COL - 0x00202020;
174188
if (ui_files_selected == i)
175189
col = ui.ops.theme.HIGHLIGHT_COL;

0 commit comments

Comments
 (0)