Allow snippets tool to be run from arbitrary CWDs (#25243)

* Allow snippets tool to be run from arbitrary CWDs

* Drop use of absolute when using Platform.executable (path is not relative, might require PATH resolution)

* canonicalize paths

* Use path.fromUri consistently to resolve file URIs

* Force commit to try to kick Cirrus

* Force commit to kick Cirrus, again
diff --git a/dev/bots/analyze-sample-code.dart b/dev/bots/analyze-sample-code.dart
index 436803c..c63b436 100644
--- a/dev/bots/analyze-sample-code.dart
+++ b/dev/bots/analyze-sample-code.dart
@@ -124,7 +124,7 @@
 
   /// Finds the location of the snippets script.
   String get _snippetsExecutable {
-    final String platformScriptPath = path.dirname(Platform.script.toFilePath());
+    final String platformScriptPath = path.dirname(path.fromUri(Platform.script));
     return path.canonicalize(path.join(platformScriptPath, '..', 'snippets', 'lib', 'main.dart'));
   }
 
@@ -206,18 +206,18 @@
     if (_snippetsSnapshotPath == null) {
       _snippetsSnapshotPath = '$_snippetsExecutable.snapshot';
       return Process.runSync(
-        path.absolute(Platform.executable),
+        path.canonicalize(Platform.executable),
         <String>[
           '--snapshot=$_snippetsSnapshotPath',
           '--snapshot-kind=app-jit',
-          path.absolute(_snippetsExecutable),
+          path.canonicalize(_snippetsExecutable),
         ]..addAll(args),
         workingDirectory: workingDirectory,
       );
     } else {
       return Process.runSync(
-        path.absolute(Platform.executable),
-        <String>[path.absolute(_snippetsSnapshotPath)]..addAll(args),
+        path.canonicalize(Platform.executable),
+        <String>[path.canonicalize(_snippetsSnapshotPath)]..addAll(args),
         workingDirectory: workingDirectory,
       );
     }