[Bf-blender-cvs] [4ce3fbd52ae] master: UI: File Browser Friendly Volume Descriptions
Harley Acheson
noreply at git.blender.org
Wed Sep 11 00:14:00 CEST 2019
Commit: 4ce3fbd52ae8bd054cfbac06ef3a1aea7568386b
Author: Harley Acheson
Date: Tue Sep 10 15:12:42 2019 -0700
Branches: master
https://developer.blender.org/rB4ce3fbd52ae8bd054cfbac06ef3a1aea7568386b
UI: File Browser Friendly Volume Descriptions
File Browser Volumes list gets nicer friendly drive names with volume label or device description.
Differential Revision: https://developer.blender.org/D5747
Reviewed by Brecht Van Lommel
===================================================================
M release/scripts/addons
M source/blender/editors/space_file/fsmenu.c
===================================================================
diff --git a/release/scripts/addons b/release/scripts/addons
index 5f3c703ea4b..eb9bab0e715 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 5f3c703ea4b0f4651e4f28e682a91382a90a5596
+Subproject commit eb9bab0e7153fda8de113af9e3c54eca74c986ef
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index c7a139a8b24..7faa2b883f2 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -492,20 +492,17 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
/* Flee from horrible win querying hover floppy drives! */
if (i > 1) {
- /* Try to get volume label as well... */
+ /* Try to get a friendly drive description. */
+ SHFILEINFOW shFile = {0};
BLI_strncpy_wchar_from_utf8(wline, tmps, 4);
- if (GetVolumeInformationW(
- wline, wline + 4, FILE_MAXDIR - 4, NULL, NULL, NULL, NULL, 0)) {
- size_t label_len;
-
- BLI_strncpy_wchar_as_utf8(line, wline + 4, FILE_MAXDIR - 4);
-
- label_len = MIN2(strlen(line), FILE_MAXDIR - 6);
- BLI_snprintf(line + label_len, 6, " (%.2s)", tmps);
-
+ if (SHGetFileInfoW(wline, 0, &shFile, sizeof(SHFILEINFOW), SHGFI_DISPLAYNAME)) {
+ BLI_strncpy_wchar_as_utf8(line, shFile.szDisplayName, FILE_MAXDIR);
name = line;
}
}
+ if (name == NULL) {
+ name = tmps;
+ }
fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, tmps, name, FS_INSERT_SORTED);
}
More information about the Bf-blender-cvs
mailing list