set appsig fr omimetype m remark in file

This commit is contained in:
Jim Saxton
2016-04-24 09:12:03 -07:00
parent c36fc02800
commit 6cac5ef25a
3 changed files with 53 additions and 16 deletions

View File

@@ -60,6 +60,7 @@ Output_file$ = peek$("argument")
Input_file$ = peek$("argument")
appsig$ = peek$("argument")
run_from_ide$ = peek$("argument")
if appsig$="" appsig$=getappsig$(Input_file$)
if appsig$="" appsig$="application/x-vnd.yab-app"
SetAppSig(appsig$)
@@ -367,6 +368,34 @@ sub SetAppSig(sig$)
end sub
/////////////////////////////////////////////////////////////
// set the application signature to match the mimetype declared in the file.
/////////////////////////////////////////////////////////////
sub getappsig$(infil$)
local x,a$,i,ii
open #22,infil$,"r"
for i=1 to 2
line input #22 a$
a$=lower$(a$)
ii = instr(a$,"mimetype")
if ii<>0 then
a$=right$(a$,len(a$) - (ii+8))
a$=trim$(a$)
a$=right$(a$,len(a$)-1)
a$=left$(a$,len(a$)-1)
close #22
return a$
endif
next
close #22
return ""
end sub
////////////////////////////////////////
////////////////////////////////////////
// the BuildFactory starts here