From e4e6a4ff6068cda8768b97609473c4d25010617c Mon Sep 17 00:00:00 2001 From: lasers Date: Mon, 13 Aug 2018 07:20:52 -0500 Subject: [PATCH] extras/convert.lua: run dos2unix too if it is available (#604) --- extras/convert.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extras/convert.lua b/extras/convert.lua index 29d48782..2d110459 100755 --- a/extras/convert.lua +++ b/extras/convert.lua @@ -9,10 +9,14 @@ Keep in mind that there is no guarantee that the output will work correctly with conky, or that it will be able to convert every conkyrc. However, it should provide a good starting point. -Altough you can use this script with only 1 arg and let it overwrite the old +Although you can use this script with only 1 arg and let it overwrite the old config, it's suggested to use 2 args so that the new config is written in a new file (so that you have backup if something went wrong). +Optional: Install dos2unix. We will attempt to use this if it is available +because Conky configs downloaded from Internet sometimes are created on DOS/Windows +machines with different line endings than Conky configs created on Unix/Linux. + For more information about the new format, read the wiki page ]]; @@ -120,6 +124,9 @@ if conky == nil then --> standalone program -- 2 args: 1st is inputfile, 2nd is outputfile -- 0, 3 or more args: print usage to STDERR and quit if #arg == 1 or #arg == 2 then + if os.execute('command -v dos2unix 2&>1') then + os.execute('dos2unix ' .. arg[1]); + end input = io.input(arg[1]); else io.stderr:write(usage);