Project

General

Profile

audacious-skin-archive.diff

one possible fix - Andriy Gapon, April 09, 2013 18:53

View differences:

src/skins/ui_skin.c 2013-04-09 19:37:28.424452521 +0300
872 870
skin_load_nolock(Skin * skin, const gchar * path, gboolean force)
873 871
{
874 872
    gchar *newpath, *skin_path;
873
    gchar *basename, *extract_path = NULL;
875 874
    int archive = 0;
876 875

  
877 876
    AUDDBG("Attempt to load skin \"%s\"\n", path);
......
890 889

  
891 890
    if (file_is_archive(path)) {
892 891
        AUDDBG("Attempt to load archive\n");
893
        if (!(skin_path = archive_decompress(path))) {
892
        if (!(extract_path = archive_decompress(path))) {
894 893
            AUDDBG("Unable to extract skin archive (%s)\n", path);
895 894
            return FALSE;
896 895
        }
896
        skin_path = g_strdup(extract_path);
897 897
        archive = 1;
898
        if (!skin_check_pixmaps(skin, skin_path)) {
899
            basename = archive_basename(path);
900
            const gchar *name = g_strrstr(basename, "/");
901
            name = name == NULL ? basename : name + 1;
902
            g_free(skin_path);
903
            skin_path = g_strdup_printf("%s/%s", extract_path, name);
904
            g_free(basename);
905
        }
898 906
    } else {
899 907
        skin_path = g_strdup(path);
900 908
    }
901 909

  
902 910
    // Check if skin path has all necessary files.
903 911
    if (!skin_check_pixmaps(skin, skin_path)) {
904
        if(archive) del_directory(skin_path);
912
        if(archive) {
913
            del_directory(extract_path);
914
            g_free(extract_path);
915
        }
905 916
        g_free(skin_path);
906 917
        AUDDBG("Skin path (%s) doesn't have all wanted pixmaps\n", skin_path);
907 918
        return FALSE;
......
921 932
    skin_parse_hints(skin, skin_path);
922 933

  
923 934
    if (!skin_load_pixmaps(skin, skin_path)) {
924
        if(archive) del_directory(skin_path);
935
        if(archive) {
936
            del_directory(extract_path);
937
            g_free(extract_path);
938
        }
925 939
        g_free(skin_path);
926 940
        AUDDBG("Skin loading failed\n");
927 941
        return FALSE;
928 942
    }
929 943

  
930
    if(archive) del_directory(skin_path);
944
    if(archive) {
945
        del_directory(extract_path);
946
        g_free(extract_path);
947
    }
931 948
    g_free(skin_path);
932 949

  
933 950
    mainwin_set_shape ();