Merge pull request #11606 from Scrumplex/feat-run-media

Also show /run/media or /run/media/$USER in drives list
This commit is contained in:
Autechre 2020-11-25 16:04:52 +01:00 committed by GitHub
commit 54eb22dd2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2063,8 +2063,10 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
}
#else
char base_path[PATH_MAX] = {0};
char udisks_media_path[PATH_MAX] = {0};
const char *xdg = getenv("XDG_CONFIG_HOME");
const char *home = getenv("HOME");
const char *user = getenv("USER");
if (xdg)
{
@ -2081,6 +2083,13 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
#endif
}
strlcpy(udisks_media_path, "/run/media", sizeof(udisks_media_path));
if (user)
{
strlcat(udisks_media_path, "/", sizeof(udisks_media_path));
strlcat(udisks_media_path, user, sizeof(udisks_media_path));
}
if(!string_is_empty(base_path))
{
menu_entries_append_enum(list, base_path,
@ -2095,6 +2104,13 @@ static int frontend_unix_parse_drive_list(void *data, bool load_content)
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
}
if (path_is_directory(udisks_media_path))
{
menu_entries_append_enum(list, udisks_media_path,
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
enum_idx,
FILE_TYPE_DIRECTORY, 0, 0);
}
if (path_is_directory("/media"))
{
menu_entries_append_enum(list, "/media",