This is useful for dynamically mounted devices like thumb drives that get mounted into a directory such as
'/media/$UID/$NAME'.
fixes #33
implies no coloring at all.
You can define a different format with the option "format_not_mounted"
-which is used if the path is not a mount point. So you can just empty
+which is used if the path does not exist or is not a mount point. So you can just empty
the output for the given path with adding +format_not_mounted=""+
to the config section.
#else
struct statvfs buf;
- if (statvfs(path, &buf) == -1)
- return;
-
- if (format_not_mounted != NULL) {
+ if (statvfs(path, &buf) == -1) {
+ /* If statvfs errors, e.g., due to the path not existing,
+ * we use the format for a not mounted device. */
+ format = format_not_mounted;
+ } else if (format_not_mounted != NULL) {
FILE *mntentfile = setmntent("/etc/mtab", "r");
struct mntent *m;
bool found = false;