From d54c46ab98224c51675e74846362e80cb5f9102b Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 13 Feb 2023 10:14:11 +0100 Subject: global-functions: introduce $Dos2Unix --- global-functions | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/global-functions b/global-functions index 84c7ece..d184650 100644 --- a/global-functions +++ b/global-functions @@ -25,6 +25,7 @@ :global CharacterReplace; :global CleanFilePath; :global DeviceInfo; +:global Dos2Unix; :global DownloadPackage; :global EitherOr; :global EscapeForRegEx; @@ -226,6 +227,15 @@ "\n Version: " . $ExpectedConfigVersion); } +# convert line endings, DOS -> UNIX +:set Dos2Unix do={ + :local Input [ :tostr $1 ]; + + :global CharacterReplace; + + :return [ $CharacterReplace $Input ("\r\n") ("\n") ]; +} + # download package from upgrade server :set DownloadPackage do={ :local PkgName [ :tostr $1 ]; -- cgit v1.2.3-70-g09d2