[Bf-blender-cvs] [8a014e780e5] master: Cleanup: use STRPREFIX for mount point checks
Campbell Barton
noreply at git.blender.org
Wed Nov 7 03:38:44 CET 2018
Commit: 8a014e780e504cb6e851af9a6c1b591e1bd9da0f
Author: Campbell Barton
Date: Wed Nov 7 13:37:42 2018 +1100
Branches: master
https://developer.blender.org/rB8a014e780e504cb6e851af9a6c1b591e1bd9da0f
Cleanup: use STRPREFIX for mount point checks
>From D3846 by @kostex
===================================================================
M source/blender/editors/space_file/fsmenu.c
===================================================================
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index f925409d882..06a78c92f09 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -598,15 +598,22 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
fp = setmntent(MOUNTED, "r");
if (fp == NULL) {
- fprintf(stderr, "could not get a list of mounted filesystemts\n");
+ fprintf(stderr, "could not get a list of mounted filesystems\n");
}
else {
while ((mnt = getmntent(fp))) {
- /* not sure if this is right, but seems to give the relevant mnts */
- if (!STREQLEN(mnt->mnt_fsname, "/dev", 4))
+ if (STRPREFIX(mnt->mnt_dir, "/boot")) {
+ /* Hide share not usable to the user. */
continue;
- if (STREQLEN(mnt->mnt_fsname, "/dev/loop", 9))
+ }
+ else if (!STRPREFIX(mnt->mnt_fsname, "/dev")) {
+ continue;
+ }
+ else if (STRPREFIX(mnt->mnt_fsname, "/dev/loop")) {
+ /* The dev/loop* entries are SNAPS used by desktop environment
+ * (Gnome) no need for them to show up in the list. */
continue;
+ }
len = strlen(mnt->mnt_dir);
if (len && mnt->mnt_dir[len - 1] != '/') {
@@ -620,7 +627,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
found = 1;
}
if (endmntent(fp) == 0) {
- fprintf(stderr, "could not close the list of mounted filesystemts\n");
+ fprintf(stderr, "could not close the list of mounted filesystems\n");
}
}
#endif
More information about the Bf-blender-cvs
mailing list