gchar *result = NULL;
gchar vname[51], fsname[51];
- if (GetVolumeInformation(drive, vname, 50, NULL, NULL, NULL, fsname, 51))
+ if (GetVolumeInformation(drive, vname, 50, NULL, NULL, NULL, fsname, 50))
{
result = g_strdup_printf("%s", vname);
}
static gchar*
get_file_label(const gchar *filename)
{
- static gchar *containers[] =
- {".vob", ".mpg", ".m2ts", ".mkv", ".mp4", ".m4v", ".avi", ".ogm", NULL};
- gchar *base;
- gint ii;
+ gchar *base, *pos, *end;
base = g_path_get_basename(filename);
- for (ii = 0; containers[ii] != NULL; ii++)
+ pos = strrchr(base, '.');
+ if (pos != NULL)
{
- if (g_str_has_suffix(base, containers[ii]))
- {
- gchar *pos;
- pos = strrchr(base, '.');
+ // If the last '.' is within 4 chars of end of name, assume
+ // there is an extension we want to strip.
+ end = &base[strlen(base) - 1];
+ if (end - pos <= 4)
*pos = 0;
- break;
- }
}
return base;
}
g_debug("update_source_label()");
len = strlen(filename);
- if (filename[len-1] == G_DIR_SEPARATOR) filename[len-1] = 0;
if (g_file_test(filename, G_FILE_TEST_IS_DIR))
{
// Skip dos drive letters
}
else
{
+ if (filename[len-1] == G_DIR_SEPARATOR) filename[len-1] = 0;
if (start != NULL)
start++;
else