X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=utils%2Finstall4j%2Fauto_file_associations-i4j8.pl;h=f2814696f1be0e5ab0539376b6f23699fb4a9f5e;hb=c484ce0509810f1703969b605e13bf8e6c103be6;hp=c418aadcfbc86ce14e54ca3138936d252eeffa90;hpb=9eab64a32b0df0d5aca966a64569c48b79cc4fbd;p=jalview.git
diff --git a/utils/install4j/auto_file_associations-i4j8.pl b/utils/install4j/auto_file_associations-i4j8.pl
index c418aad..f281469 100755
--- a/utils/install4j/auto_file_associations-i4j8.pl
+++ b/utils/install4j/auto_file_associations-i4j8.pl
@@ -23,7 +23,7 @@ my $mimetypes = {
scorematrix => "application/x-jalview-scorematrix+text",
pdb => "chemical/x-pdb",
mmcif => "chemical/x-cif",
- mmcif2 => "chemical/x-mcif",
+ mmcif2 => "chemical/x-mmcif",
jalview => "application/x-jalview+xml+zip",
jvl => "application/x-jalview-jvl+text",
annotations => "application/x-jalview-annotations+text",
@@ -37,6 +37,7 @@ my $add_associations = {
gff3 => {shortname=>"gff3",name=>"Generic Features Format v3",extensions=>["gff3"]},
features => {shortname=>"features",name=>"Jalview Features",extensions=>["features","jvfeatures"]},
annotations => {shortname=>"annotations",name=>"Jalview Annotations",extensions=>["annotations","jvannotations"]},
+ mmcif => {shortname=>"mmcif",name=>"CIF",extensions=>["cif"]},
mmcif2 => {shortname=>"mmcif2",name=>"mmCIF",extensions=>["mcif","mmcif"]},
jvl => {shortname=>"jvl",name=>"Jalview Launch",extensions=>["jvl"],iconfile=>"Jalview-Launch"},
jnet => {shortname=>"jnet",name=>"JnetFile",extensions=>["concise","jnet"]},
@@ -120,25 +121,16 @@ close(IN);
my %all_associations = (%$file_associations, %$add_associations);
-my $num = 0;
-my $i4jcount = 0;
my @ordered = (@put_first, @non_primary);
for my $key (sort keys %all_associations) {
next if grep($_ eq $key, @ordered);
push(@ordered, $key);
}
-for my $key (@ordered) {
- my $a = $all_associations{$key};
- next if (ref($a) ne "HASH");
-
- my $extensions = $a->{extensions};
- my @extensions = @$extensions;
-
- $num++
-}
+my $num = $#ordered + 1;
warn("--\n");
+my $i4jcount = 0;
for my $shortname (@ordered) {
my $a = $all_associations{$shortname};
next if (ref($a) ne "HASH");
@@ -162,6 +154,7 @@ for my $shortname (@ordered) {
my $xshortname = xml_escape($shortname);
my $xiconfile = xml_escape($iconfile);
my $xrole = xml_escape($role);
+ my $xROLE = xml_escape(uc($role));
my $xprimarystring = xml_escape($primarystring);
my $macentry = $mactemplate;
@@ -189,12 +182,13 @@ for my $shortname (@ordered) {
$i4jentry =~ s/\$\$MIMETYPE\$\$/$xmimetype/g;
$i4jentry =~ s/\$\$ICONFILE\$\$/$xiconfile/g;
$i4jentry =~ s/\$\$PRIMARY\$\$/$xprimarystring/g;
+ $i4jentry =~ s/\$\$MACASSOCIATIONROLE\$\$/$xROLE/g;
my $ext = join(",",sort(@extensions));
my $xdisplayext = xml_escape(join(", ", map(".$_",sort(@extensions))));
- $i4jcount++;
my $progresspercent = int(($i4jcount/$num)*100);
$progresspercent = 100 if $progresspercent > 100;
+ $i4jcount++;
my $xext = xml_escape($ext);
my $addunixextension = "true";
@@ -217,29 +211,11 @@ for my $shortname (@ordered) {
close(IA);
print MA "\n";
-#
-# print MA "
-#
-# CFBundleURLTypes
-#
-#
-# CFBundleURLName
-# org.jalview.jalview-desktop.url.jalview
-# CFBundleTypeRole
-# Editor
-# CFBundleURLSchemes
-#
-# jalview
-#
-#
-#
-#
-# ";
close(MA);
sub xml_escape {
my $x = shift;
# stolen from Pod::Simple::XMLOutStream in base distro
- $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/''.(ord($1)).';'/eg;
+ $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}a-zA-Z0-9])/''.(ord($1)).';'/eg;
return $x;
}