Updated search for pub cache directory on windows to align with the d… (#44)

Updated search for pub cache directory on windows to align with the dart documenation on where it is located. Logic falls back to original version of the pub cache can't be found at the expected version. The dart doco says the location can vary on different windows version and I suspect that fact is the source of this problem.
diff --git a/.gitignore b/.gitignore
index a91da7f..0e66d7d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@
 .packages
 pubspec.lock
 pub_cache.iml
+.history
diff --git a/lib/pub_cache.dart b/lib/pub_cache.dart
index 9538d36..191a28e 100644
--- a/lib/pub_cache.dart
+++ b/lib/pub_cache.dart
@@ -21,8 +21,18 @@
 
     if (env.containsKey('PUB_CACHE')) {
       return new Directory(env['PUB_CACHE']);
-    } else if (Platform.operatingSystem == 'windows') {
-      return new Directory(path.join(env['APPDATA'], '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 appDataCacheDir =
+          new Directory(path.join(env['APPDATA'], 'Pub', 'Cache'));
+      if (appDataCacheDir.existsSync()) {
+        return appDataCacheDir;
+      }
+      return new Directory(path.join(env['LOCALAPPDATA'], 'Pub', 'Cache'));
     } else {
       return new Directory('${env['HOME']}/.pub-cache');
     }