windowsTestPathScript function

String windowsTestPathScript(
  1. String path, {
  2. bool directory = false,
})

Exits 0 when path exists — as a directory, if directory — and 1 when not (an error, being neither, exits otherwise).

Implementation

String windowsTestPathScript(String path, {bool directory = false}) =>
    'if (Test-Path -LiteralPath ${_psq(path)}'
    '${directory ? ' -PathType Container' : ''}) { exit 0 } else { exit 1 }';