nextToScript function
The path of a file in the same folder as the running script.
Handy for tools you ship next to your code, like bin/speedtest.exe.
If the file isn't there, fileName is given back as it is, so
Process.start tries your PATH instead.
await Process.start(nextToScript('speedtest.exe'), []);
Implementation
String nextToScript(String fileName) {
final file = File.fromUri(Platform.script.resolve(fileName));
if (file.existsSync()) return file.path;
return fileName;
}