CalicoSkies

Synchronet Javascript: Preparing a command with double quotes for system.exec() for use on Windows

Apr 10th, 2025 (edited)
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.78 KB | Source Code | 0 0
  1. // By default, this assumes use of the 'convert' program from ImageMagick.
  2. // See if the conversion command uses magick. If so, don't use the
  3. // -coalesce option.
  4. if (gMainCfgObj.PathToImgToSixelConv.toUpperCase().indexOf("MAGICK") > -1)
  5.     cmd = format("\"%s\" \"%s\" %s \"%s\"", gMainCfgObj.PathToImgToSixelConv, pSrcImgFilename, pScale ? ("-resize " + maxWidth + "x" + maxHeight + " ") : "", pDestImgFilename);
  6. else
  7.     cmd = format("\"%s\" -coalesce \"%s\" %s \"%s\"", gMainCfgObj.PathToImgToSixelConv, pSrcImgFilename, pScale ? ("-resize " + maxWidth + "x" + maxHeight + " ") : "", pDestImgFilename);
  8. // If running on Windows, it seems we need an additional set of double-quotes around the whole command line
  9. if (/^WIN/.test(system.platform.toUpperCase()))
  10.     cmd = format("\"%s\"", cmd);
Add Comment
Please, Sign In to add comment