Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-07-29 02:44:50 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-29 02:44:50 +0400
commita638f611a8893f2b598c103920945737cda3da92 (patch)
tree5cc7fd798fc2058d139829b8b87769675be74907 /source/blender/editors/space_file
parente3f6770bd3daf7d55654fe460fc81e4806bbfdfe (diff)
list the filesystems on linux.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/fsmenu.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 12a3c38ab09..41d97e1e0ae 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -58,6 +58,10 @@
#include "BKE_utildefines.h"
#endif
+#ifdef __linux__
+#include <mntent.h>
+#endif
+
#include "fsmenu.h" /* include ourselves */
@@ -303,7 +307,7 @@ void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
char dir[FILE_MAXDIR];
char *home= BLI_gethome();
- fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, "/", 1, 0);
+ // fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, "/", 1, 0);
if(home) {
BLI_snprintf(dir, FILE_MAXDIR, "%s/", home);
@@ -311,6 +315,33 @@ void fsmenu_read_file(struct FSMenu* fsmenu, const char *filename)
BLI_snprintf(dir, FILE_MAXDIR, "%s/Desktop/", home);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, dir, 1, 0);
}
+
+ {
+ /* loop over mount points */
+ struct mntent *mnt;
+ FILE *fp;
+ fp = setmntent (MOUNTED, "r");
+ if (fp == NULL) {
+ fprintf(stderr, "could not get a list of mounted filesystemts\n");
+ }
+ else {
+ while ((mnt = getmntent (fp))) {
+ /* printf("%s %s %s %s %s %s\n", mnt->mnt_fsname, mnt->mnt_dir, mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq, mnt->mnt_passno); */
+
+ /* probably need to add more here */
+ if( (strcmp (mnt->mnt_fsname, "none")==0) || /* /sys, /dev/pts */
+ (strcmp (mnt->mnt_type, "ramfs")==0) /* /dev */
+ ) {
+ continue;
+ }
+
+ fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, mnt->mnt_dir, 1, 0);
+ }
+ if (endmntent (fp) == 0) {
+ fprintf(stderr, "could not close the list of mounted filesystemts\n");
+ }
+ }
+ }
}
#endif
#endif