From ebddf92d65d91801d588602b95947cee3014c757 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Sat, 23 Nov 2019 10:17:20 +0000 Subject: [PATCH] JAL-3420 multiple file extensions for the same mime-type now work in unix installer --- utils/install4j/auto_file_associations-i4j8.pl | 104 ++-- .../file_associations_auto-install4j8.xml | 533 ++++++-------------- .../file_associations_template-install4j8.xml | 5 +- utils/install4j/install4j8_template.install4j | 2 +- 4 files changed, 226 insertions(+), 418 deletions(-) diff --git a/utils/install4j/auto_file_associations-i4j8.pl b/utils/install4j/auto_file_associations-i4j8.pl index 71044fe..df04a6a 100755 --- a/utils/install4j/auto_file_associations-i4j8.pl +++ b/utils/install4j/auto_file_associations-i4j8.pl @@ -106,7 +106,7 @@ while(my $line = ) { name => $name, extensions => \@extensions }; - warn("Adding file association for $shortname\n"); + warn("Adding file association for $shortname (".join(",",@extensions).")\n"); } } close(IN); @@ -126,9 +126,13 @@ for my $key (@ordered) { my $extensions = $a->{extensions}; my @extensions = @$extensions; - for my $ext (@extensions) { - $num++; - } + + # multiple extensions now all dealt with together since i4j 8.0.1 + #for my $ext (@extensions) { + # $num++; + #} + $num++ + #delete $all_associations{$shortname}; #print "NUM: $num\n"; } @@ -178,40 +182,66 @@ for my $shortname (@ordered) { $i4jentry =~ s/\$\$MIMETYPE\$\$/$xmimetype/g; $i4jentry =~ s/\$\$ICONFILE\$\$/$xiconfile/g; - my $unixext; - for my $ext (sort @extensions) { - if (not defined($unixext)) { - $unixext = $ext; - next; - } - if (length($ext) < length($unixext)) { - $unixext = $ext; - next; - } - } +# multiple extensions now all dealt with together since i4j 8.0.1 +# my $unixext; +# for my $ext (sort @extensions) { +# if (not defined($unixext)) { +# $unixext = $ext; +# next; +# } +# if (length($ext) < length($unixext)) { +# $unixext = $ext; +# next; +# } +# } +# for my $ext (@extensions) { +# $i4jcount++; +# #print "COUNT: $i4jcount\n"; +# my $progresspercent = int(($i4jcount/$num)*100); +# #print "PC: $progresspercent\n"; +# $progresspercent = 100 if $progresspercent > 100; +# my $xext = xml_escape($ext); +# my $addunixextension = ($ext eq $unixext)?"true":"false"; +# +# my $i4jextentry = $i4jentry; +# $i4jextentry =~ s/\$\$ADDUNIXEXTENSION\$\$/$addunixextension/g; +# $i4jextentry =~ s/\$\$EXTENSION\$\$/$xext/g; +# $i4jextentry =~ s/\$\$PROGRESSPERCENT\$\$/$progresspercent/g; +# $i4jextentry =~ s/\$\$ID\$\$/$id/g; +# $id++; +# $i4jextentry =~ s/\$\$ID1\$\$/$id/g; +# $id++; +# $i4jextentry =~ s/\$\$ID2\$\$/$id/g; +# $id++; +# +# print IA $i4jextentry; +# } + + my $ext = join(",",sort(@extensions)); + my $xdisplayext = xml_escape(join(", ", map(".$_",sort(@extensions)))); + $i4jcount++; +#print "COUNT: $i4jcount\n"; + my $progresspercent = int(($i4jcount/$num)*100); +#print "PC: $progresspercent\n"; + $progresspercent = 100 if $progresspercent > 100; + my $xext = xml_escape($ext); + #my $addunixextension = ($ext eq $unixext)?"true":"false"; + my $addunixextension = "true"; + + my $i4jextentry = $i4jentry; + $i4jextentry =~ s/\$\$ADDUNIXEXTENSION\$\$/$addunixextension/g; + $i4jextentry =~ s/\$\$EXTENSION\$\$/$xext/g; + $i4jextentry =~ s/\$\$DISPLAYEXTENSION\$\$/$xdisplayext/g; + $i4jextentry =~ s/\$\$PROGRESSPERCENT\$\$/$progresspercent/g; + $i4jextentry =~ s/\$\$ID\$\$/$id/g; + $id++; + $i4jextentry =~ s/\$\$ID1\$\$/$id/g; + $id++; + $i4jextentry =~ s/\$\$ID2\$\$/$id/g; + $id++; + + print IA $i4jextentry; - for my $ext (@extensions) { - $i4jcount++; - #print "COUNT: $i4jcount\n"; - my $progresspercent = int(($i4jcount/$num)*100); - #print "PC: $progresspercent\n"; - $progresspercent = 100 if $progresspercent > 100; - my $xext = xml_escape($ext); - my $addunixextension = ($ext eq $unixext)?"true":"false"; - - my $i4jextentry = $i4jentry; - $i4jextentry =~ s/\$\$ADDUNIXEXTENSION\$\$/$addunixextension/g; - $i4jextentry =~ s/\$\$EXTENSION\$\$/$xext/g; - $i4jextentry =~ s/\$\$PROGRESSPERCENT\$\$/$progresspercent/g; - $i4jextentry =~ s/\$\$ID\$\$/$id/g; - $id++; - $i4jextentry =~ s/\$\$ID1\$\$/$id/g; - $id++; - $i4jextentry =~ s/\$\$ID2\$\$/$id/g; - $id++; - - print IA $i4jextentry; - } delete $all_associations{$shortname}; } diff --git a/utils/install4j/file_associations_auto-install4j8.xml b/utils/install4j/file_associations_auto-install4j8.xml index 05c307f..d37b053 100644 --- a/utils/install4j/file_associations_auto-install4j8.xml +++ b/utils/install4j/file_associations_auto-install4j8.xml @@ -1,3 +1,4 @@ + Jalview (.jvp) @@ -6,9 +7,10 @@ + - + @@ -39,7 +41,9 @@ + + Jalview Launch (.jvl) @@ -48,9 +52,10 @@ + - + @@ -81,7 +86,9 @@ + + AMSA (.amsa) @@ -90,9 +97,10 @@ + - + @@ -123,25 +131,28 @@ + + - Jalview Annotations (.annotations) + Jalview Annotations (.annotations, .jvannotations) Creating file associations... + - + - + Jalview Annotations File - annotations + annotations,jvannotations 737 @@ -165,64 +176,25 @@ + + - Jalview Annotations (.jvannotations) - Creating file associations... - - - - - - - - - - - - - Jalview Annotations File - jvannotations - 737 - - - Jalview-File.icns - - - - - - - - - Jalview-File.png - - - application/x-jalview-annotations+text - - - Jalview-File.ico - - - - - - - BioJSON (.biojson) Creating file associations... - + + - + - + BioJSON File biojson @@ -249,8 +221,10 @@ + - + + BLC (.blc) Creating file associations... @@ -258,13 +232,14 @@ - + + - + - + BLC File blc @@ -291,8 +266,10 @@ + - + + Clustal (.aln) Creating file associations... @@ -300,13 +277,14 @@ - + + - + - + Clustal File aln @@ -333,25 +311,28 @@ + - + + - Fasta (.fa) + Fasta (.fa, .fasta) Creating file associations... - + + - + - + Fasta File - fa + fa,fasta 737 @@ -375,67 +356,28 @@ + - + + - Fasta (.fasta) + Jalview Features (.features, .jvfeatures) Creating file associations... - - - - - - - - Fasta File - fasta - 737 - - - Jalview-File.icns - - - - - - - - - Jalview-File.png - - - application/x-fasta+txt - - - Jalview-File.ico - - - - - - - - Jalview Features (.features) - Creating file associations... - - - - - + - + - + Jalview Features File - features + features,jvfeatures 737 @@ -459,50 +401,10 @@ + - - - Jalview Features (.jvfeatures) - Creating file associations... - - - - - - - - - - - - - Jalview Features File - jvfeatures - 737 - - - Jalview-File.icns - - - - - - - - - Jalview-File.png - - - application/x-jalview-features+text - - - Jalview-File.ico - - - - - - + + Generic Features Format v2 (.gff2) Creating file associations... @@ -510,13 +412,14 @@ - + + - + Generic Features Format v2 File gff2 @@ -543,8 +446,10 @@ + - + + Generic Features Format v3 (.gff3) Creating file associations... @@ -552,13 +457,14 @@ - + + - + - + Generic Features Format v3 File gff3 @@ -585,67 +491,28 @@ + - + + - JnetFile (.concise) + JnetFile (.concise, .jnet) Creating file associations... - - - - - - - - - JnetFile File - concise - 737 - - - Jalview-File.icns - - - - - - - - - Jalview-File.png - - - application/x-jalview-jnet+text - - - Jalview-File.ico - - - - - - - JnetFile (.jnet) - Creating file associations... - - - - - + - + - + JnetFile File - jnet + concise,jnet 737 @@ -669,8 +536,10 @@ + - + + mmCIF (.cif) Creating file associations... @@ -678,13 +547,14 @@ - + + - + mmCIF File cif @@ -711,25 +581,28 @@ + - + + - mmCIF (.mcif) + mmCIF (.mcif, .mmcif) Creating file associations... - + + - + mmCIF File - mcif + mcif,mmcif 737 @@ -753,50 +626,10 @@ + - - - mmCIF (.mmcif) - Creating file associations... - - - - - - - - - - - - - mmCIF File - mmcif - 737 - - - Jalview-File.icns - - - - - - - - - Jalview-File.png - - - chemical/x-mcif - - - Jalview-File.ico - - - - - - + + MSF (.msf) Creating file associations... @@ -804,13 +637,14 @@ - + + - + - + MSF File msf @@ -837,67 +671,28 @@ + - + + - PDB (.pdb) + PDB (.ent, .pdb) Creating file associations... - - - - - - - - PDB File - pdb - 737 - - - Jalview-File.icns - - - - - - - - - Jalview-File.png - - - chemical/x-pdb - - - Jalview-File.ico - - - - - - - - PDB (.ent) - Creating file associations... - - - - - + - + - + PDB File - ent + ent,pdb 737 @@ -921,8 +716,10 @@ + - + + PFAM (.pfam) Creating file associations... @@ -930,13 +727,14 @@ - + + - + - + PFAM File pfam @@ -963,8 +761,10 @@ + - + + PHYLIP (.phy) Creating file associations... @@ -972,13 +772,14 @@ - + + - + - + PHYLIP File phy @@ -1005,8 +806,10 @@ + - + + PileUp (.pileup) Creating file associations... @@ -1014,13 +817,14 @@ - + + - + - + PileUp File pileup @@ -1047,8 +851,10 @@ + - + + PIR (.pir) Creating file associations... @@ -1056,13 +862,14 @@ - + + - + PIR File pir @@ -1089,8 +896,10 @@ + - + + RNAML (.rnaml) Creating file associations... @@ -1098,13 +907,14 @@ - + + - + - + RNAML File rnaml @@ -1131,8 +941,10 @@ + - + + Substitution Matrix (.mat) Creating file associations... @@ -1140,13 +952,14 @@ - + + - + - + Substitution Matrix File mat @@ -1173,67 +986,28 @@ + - + + - Stockholm (.sto) + Stockholm (.stk, .sto) Creating file associations... - - - - - - - - - Stockholm File - sto - 737 - - - Jalview-File.icns - - - - - - - - - Jalview-File.png - - - application/x-stockholm+txt - - - Jalview-File.ico - - - - - - - Stockholm (.stk) - Creating file associations... - - - - - + - + Stockholm File - stk + stk,sto 737 @@ -1257,4 +1031,5 @@ + diff --git a/utils/install4j/file_associations_template-install4j8.xml b/utils/install4j/file_associations_template-install4j8.xml index cb9ebf8..bd1a4e1 100644 --- a/utils/install4j/file_associations_template-install4j8.xml +++ b/utils/install4j/file_associations_template-install4j8.xml @@ -1,11 +1,13 @@ + - $$NAME$$ (.$$EXTENSION$$) + $$NAME$$ ($$DISPLAYEXTENSION$$) Creating file associations... + @@ -39,4 +41,5 @@ + diff --git a/utils/install4j/install4j8_template.install4j b/utils/install4j/install4j8_template.install4j index 649d1f5..7860656 100644 --- a/utils/install4j/install4j8_template.install4j +++ b/utils/install4j/install4j8_template.install4j @@ -405,7 +405,7 @@ return console.askOkCancel(message, true); - + -- 1.7.10.2