{"file.date", N_("File date"), NULL},
{"file.mode", N_("File mode"), NULL},
{"file.ctime", N_("File ctime"), NULL},
+ {"file.owner", N_("File owner"), NULL},
+ {"file.group", N_("File group"), NULL},
+ {"file.link", N_("File link"), NULL},
+ {"file.class", N_("File class"), NULL},
{ NULL, NULL, NULL }
};
{
return g_strdup(text_from_time(fd->cdate));
}
+ if (strcmp(key, "file.class") == 0)
+ {
+ return g_strdup(format_class_list[fd->format_class]);
+ }
+ if (strcmp(key, "file.owner") == 0)
+ {
+ return g_strdup(fd->owner);
+ }
+ if (strcmp(key, "file.group") == 0)
+ {
+ return g_strdup(fd->group);
+ }
+ if (strcmp(key, "file.link") == 0)
+ {
+ return g_strdup(fd->sym_link);
+ }
return g_strdup("");
}
#include "secure_save.h"
#include "exif.h"
+#include "misc.h"
#include <errno.h>
+#include <grp.h>
#ifdef DEBUG_FILEDATA
gint global_file_data_count = 0;
static FileData *file_data_new(const gchar *path_utf8, struct stat *st, gboolean disable_sidecars)
{
FileData *fd;
+ struct passwd *user;
+ struct group *group;
DEBUG_2("file_data_new: '%s' %d", path_utf8, disable_sidecars);
fd->rating = STAR_RATING_NOT_READ;
fd->format_class = filter_file_get_class(path_utf8);
+ user = getpwuid(st->st_uid);
+ if (!user)
+ {
+ fd->owner = g_strdup_printf("%u", st->st_uid);
+ }
+ else
+ {
+ fd->owner = g_strdup(user->pw_name);
+ }
+
+ group = getgrgid(st->st_gid);
+ if (!group)
+ {
+ fd->group = g_strdup_printf("%u", st->st_gid);
+ }
+ else
+ {
+ fd->group = g_strdup(group->gr_name);
+ }
+
+ fd->sym_link = get_symbolic_link(path_utf8);
+
if (disable_sidecars) fd->disable_grouping = TRUE;
file_data_set_path(fd, path_utf8); /* set path, name, collate_key_*, original_path */
g_free(fd->extended_extension);
if (fd->thumb_pixbuf) g_object_unref(fd->thumb_pixbuf);
histmap_free(fd->histmap);
-
+ g_free(fd->owner);
+ g_free(fd->group);
+ g_free(fd->sym_link);
g_assert(fd->sidecar_files == NULL); /* sidecar files must be freed before calling this */
file_data_change_info_free(NULL, fd);
return ret;
}
+gchar *get_symbolic_link(const gchar *path_utf8)
+{
+ gchar *sl;
+ struct stat st;
+ gchar *ret = g_strdup("");
+
+ sl = path_from_utf8(path_utf8);
+
+ if (lstat(sl, &st) == 0 && S_ISLNK(st.st_mode))
+ {
+ gchar *buf;
+ gint l;
+
+ buf = g_malloc(st.st_size + 1);
+ l = readlink(sl, buf, st.st_size);
+
+ if (l == st.st_size)
+ {
+ buf[l] = '\0';
+
+ ret = buf;
+ }
+ else
+ {
+ g_free(buf);
+ }
+ }
+
+ g_free(sl);
+
+ return ret;
+}
+
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
gint date_get_first_day_of_week();
gchar *date_get_abbreviated_day_name(gint day);
gchar *convert_rating_to_stars(gint rating);
+gchar *get_symbolic_link(const gchar *path_utf8);
#endif /* MISC_H */
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
gint rating;
gboolean metadata_in_idle_loaded;
+ gchar *owner;
+ gchar *group;
+ gchar *sym_link;
+
SelectionType selected; // Used by view_file_icon.
};
<td class="td-rowsep">file mode flags</td>
</tr>
<tr>
-<td class="td-colsep">file.ctime</td>
-<td>refer to operating system documentation for the meaning of ctime</td>
+<td class="td-colsep td-rowsep">file.ctime</td>
+<td class="td-rowsep">refer to operating system documentation for the meaning of ctime</td>
+</tr>
+<tr class="tr-shade">
+<td class="td-colsep td-rowsep">file.owner</td>
+<td class="td-rowsep">the file's owner. Refer to operating system documentation for the meaning of file permissions</td>
+</tr>
+<tr>
+<td class="td-colsep td-rowsep">file.group</td>
+<td class="td-rowsep">the file's group. Refer to operating system documentation for the meaning of file permissions</td>
+</tr>
+<tr class="tr-shade">
+<td class="td-colsep td-rowsep">file.class</td>
+<td class="td-rowsep">the file's class e.g. Image, RAW image etc.</td>
+</tr>
+<tr>
+<td class="td-colsep">file.link</td>
+<td>if the file is a symbolic link, shows the path of the source file</td>
</tr>
</tbody></table>
</div>