Use LOCALAPPDATA for system cache on windows (#2297)

Use `%LOCALAPPDATA%` for `.pub-cache` on windows if `.pub-cache` doesn't already existing in  `%APPDATA%`.

Using `%LOCALAPPDATA%` is better because it's not copied when users roam between devices.
diff --git a/lib/src/system_cache.dart b/lib/src/system_cache.dart
index 57f7fe0..00c918f 100644
--- a/lib/src/system_cache.dart
+++ b/lib/src/system_cache.dart
@@ -35,8 +35,18 @@
     if (Platform.environment.containsKey('PUB_CACHE')) {
       return Platform.environment['PUB_CACHE'];
     } else if (Platform.isWindows) {
+      // %LOCALAPPDATA% is preferred as the cache location over %APPDATA%, because the latter is synchronised between
+      // devices when the user roams between them, whereas the former is not.
+      // The default cache dir used to be in %APPDATA%, so to avoid breaking old installs,
+      // we use the old dir in %APPDATA% if it exists. Else, we use the new default location
+      // in %LOCALAPPDATA%.
       var appData = Platform.environment['APPDATA'];
-      return p.join(appData, 'Pub', 'Cache');
+      var appDataCacheDir = p.join(appData, 'Pub', 'Cache');
+      if (dirExists(appDataCacheDir)) {
+        return appDataCacheDir;
+      }
+      var localAppData = Platform.environment['LOCALAPPDATA'];
+      return p.join(localAppData, 'Pub', 'Cache');
     } else {
       return '${Platform.environment['HOME']}/.pub-cache';
     }