From bf14b2ddb1c535a97f1eded6b874e96f00f51d4f Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 17 Jan 2015 12:52:09 +0000 Subject: [PATCH] Make adding NetSurf to launch-handler more robust: Now handles when the user hasn't ever saved their config Doesn't attempt to add when auto-installing Removes need for fitr --- amiga/Makefile.target | 1 - amiga/dist/Install | 85 ++++++++++++++++++++++-------------------- amiga/pkg/fitr | Bin 69385 -> 0 bytes 3 files changed, 44 insertions(+), 42 deletions(-) delete mode 100755 amiga/pkg/fitr diff --git a/amiga/Makefile.target b/amiga/Makefile.target index 3d76b3e84..d29e7aa17 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -114,7 +114,6 @@ netsurf.lha: $(EXETARGET) $(Q)cp \!NetSurf/Resources/internal.css,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/internal.css $(Q)cp \!NetSurf/Resources/Quirks,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/quirks.css $(Q)cp \!NetSurf/Resources/netsurf.png,b60 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/netsurf.png - $(Q)cp amiga/pkg/fitr $(AMIGA_INSTALL_TARGET_DIR)/NetSurf $(Q)cp amiga/pkg/drawer.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf.info $(Q)cp amiga/pkg/AutoInstall $(AMIGA_INSTALL_TARGET_DIR) $(call split_install_messages, ami, $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/) diff --git a/amiga/dist/Install b/amiga/dist/Install index 6a3e47855..a0a2bf4e1 100755 --- a/amiga/dist/Install +++ b/amiga/dist/Install @@ -13,38 +13,38 @@ ) ) -; The below procedure is part of "fitr", see -; http://www.unsatisfactorysoftware.co.uk/fitr -(procedure p_fitr #filename #text #comment #flags - (set #comstring "") - (if #comment (set #comstring (cat "COMMENT=\"" #comment "\""))) - (set #comment "") - (set #switches "") - (if #flags (set #switches (cat " " #flags))) - (set #flags "") +(procedure p_append #filename #text + (set #file-path (tackon "ENVARC:launch-handler/URL" #protocol)) + (set #def-file-path (tackon "ENVARC:launch-handler/URL/defaults" #protocol)) - (if #text + (if (exists #file-path) ( - (transcript "Adding " @app-name " section to " #filename) - - (textfile - (dest "t:fitr-installer.tmp") - (append #text) - ) - - (run (cat "fitr \"" #filename "\" \"" @app-name "\" t:fitr-installer.tmp " #comstring #switches)) - (delete "t:fitr-installer.tmp") + (set #inc #file-path) ) -;else + ;else ( - (transcript "Removing " @app-name " section from " #filename) - (run (cat "fitr \"" #filename "\" \"" @app-name "\" " #comstring #switches)) + (set #inc #def-file-path) ) ) + + (textfile + (dest #file-path) + (include #inc) + (append #text) + ) ) (procedure p_chk_launch-handler #protocol - (run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL" #protocol) " NetSurf" (safe)) + (if (exists (tackon "ENVARC:launch-handler/URL" #protocol)) + ( + (run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL" #protocol) " NetSurf" (safe)) + ) + ;else + ( + (run "C:Search >T:NS_Install.tmp " (tackon "ENVARC:launch-handler/URL/defaults" #protocol) " NetSurf" (safe)) + ) + ) + (set #has_entry (getsize "T:NS_Install.tmp")) ) @@ -142,14 +142,22 @@ (if (>= osver 53) ( - (set #addlaunchhandler - (askbool - (prompt "Add NetSurf to launch-handler? (recommended)") - (help "launch-handler is part of OS4.1 which opens URLs " - " by launching a web browser.\n\n" - "The installation will update the configuration of " - "OS4.1 to allow URLs to be opened by NetSurf.") - (default 1) + (if (= #AutoInstall 1) + ( + (set #addlaunchhandler 0) + ) + ;else + ( + (set #addlaunchhandler + (askbool + (prompt "Add NetSurf to launch-handler? (recommended)") + (help "launch-handler is part of OS4.1 which opens URLs " + " by launching a web browser.\n\n" + "The installation will update the configuration of " + "OS4.1 to allow URLs to be opened by NetSurf.") + (default 1) + ) + ) ) ) ) @@ -360,30 +368,25 @@ (if (= #addlaunchhandler 1) ( -; We use fitr here so that the sections are only added once. -; We also check for string "NetSurf" within the files as saving -; the config will overwrite fitr's tags. -; This probably needs rewriting to not use fitr as it isn't really necessary now. - (working "Adding NetSurf to launch-handler config") (if (= (p_chk_launch-handler "FILE.LH") 0) - (p_fitr "ENVARC:launch-handler/URL/FILE.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"file:///%s*\"\"") + (p_append "FILE.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"file:///%s*\"\"") ) (if (= (p_chk_launch-handler "HTTP.LH") 0) - (p_fitr "ENVARC:launch-handler/URL/HTTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://%s*\"\"") + (p_append "HTTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://%s*\"\"") ) (if (= (p_chk_launch-handler "HTTPS.LH") 0) - (p_fitr "ENVARC:launch-handler/URL/HTTPS.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"https://%s*\"\"") + (p_append "HTTPS.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"https://%s*\"\"") ) (if (= (p_chk_launch-handler "WWW.LH") 0) - (p_fitr "ENVARC:launch-handler/URL/WWW.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://www.%s*\"\"") + (p_append "WWW.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"http://www.%s*\"\"") ) ; (if (= (p_chk_launch-handler "FTP.LH") 0) -; (p_fitr "ENVARC:launch-handler/URL/FTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"ftp://%s*\"\"") +; (p_append "FTP.LH" "ClientName=\"NETSURF\" ClientPath=\"Rexx:NetSurf\" CMDFORMAT=\"*\"ftp://%s*\"\"") ; ) ) ) diff --git a/amiga/pkg/fitr b/amiga/pkg/fitr deleted file mode 100755 index d022ebf1e71a20cac0da08bdfac7d891e7798830..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 69385 zcmeI0e{h_|dB>kUouu7DUF%Nrt0ymgQKoC6JI13O2?hZltqx#)tK5 z?#}V6Lr=cy4T}KWcj|-iSQxZyI!`Q)45=e%I&~d=k z_4~Z{?%ivLv`wNvG?V9MUhT8bKKtym&wh5_eU)hMzF9dG<$n&Ugsh;6q4blY8MDn# zUUE=pV6qq6Z-bK{NHpy$$6Z<;JulvU1OUGNLs5^O$qq#XrMcl7{ zck+tWGgPTt>vRSyF+sL>zB?a_M;M6rJLD0!T|LOjTz5ElRCgPPB#)=MI$pn9nS9JIICHxSG!@ zwJ%5>)+cITH1^d{d7}L#BXEMenUhqHeiZl*s$1nM+mgJRdQ;a^bE*rmAy0SSS~|yL zBfgV~qiKPa|sOJd%(;TZ^_uI|;H|MV_oBcZ0`4q2nV5aD2n2SH&ztqSaqq?=2 zUnWJ~)TgK}bB^lck1jLf&LU%CS(lMoPTd(ro=go@PAo4vm}#Y|OpvNG2dLJ}V{YyI zSPy?1c4^r0I;3HjhFuzd)38lroHTr6of>(Kc&x;Etj|o*&-FO$-}E_=L&)mab;*AdtW^k=Hmm8gj#1ZVNrWXx8 zPCi$KToiJ}eg;n)iAP^IY`MHNR~RFotLB{j<@riMZ|+yvV!saQSab~B&aqCuaoA#^ zuwK8*{3nuh-6u=P`B2T=S>6wsl=9#VGBO8LC7*MdW2!3t8rJKas^+~gT|?)mTj{Oo zAiXo4qIahc&@ZQt(FLsQ#f-vPSEHPnR^`eBRry|}YWJn+Z0jC}x9J?t3j~PsZ*$_! z4~@y!4;xL#XsG+d%Bc=2eS_N)kH2l8eb8)w{#%CC_Rq{Kp9QG^)iDE2{X|yY3Jm1- z$zTfOO%8m`NMh_M#5yshyb~$qokGma#6&XXokHwWhhz2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