[pkg/dartdev] Use ~/.dart/dartdev/sdk_cache as the SDK cache directory.

Currently, the SDK cache for cross compilers uses ~/.dart if the user's
home directory exists. Instead, use ~/.dart/dartdev/sdk_cache to avoid
polluting the top level of ~/.dart with cache directories.

TEST=pkg/dartdev

Issue: https://github.com/dart-lang/sdk/issues/60922
Change-Id: Ifc69e2a53abc6627c65f4fb30f94b1c3c25c7064
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/438701
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
diff --git a/pkg/dartdev/lib/src/commands/compile.dart b/pkg/dartdev/lib/src/commands/compile.dart
index 02aa1d0..ab36839 100644
--- a/pkg/dartdev/lib/src/commands/compile.dart
+++ b/pkg/dartdev/lib/src/commands/compile.dart
@@ -602,7 +602,9 @@
       }
 
       var cacheDir = getDartStorageDirectory();
-      if (cacheDir == null) {
+      if (cacheDir != null) {
+        cacheDir = Directory(path.join(cacheDir.path, 'dartdev', 'sdk_cache'));
+      } else {
         cacheDir = Directory.systemTemp.createTempSync();
         log.stdout('Cannot get dart storage directory. '
             'Using temp dir ${cacheDir.path}');