Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Unified Diff: pkg/analyzer/lib/file_system/physical_file_system.dart

Issue 632353002: Add support for cross-session storage (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/file_system/physical_file_system.dart
diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart
index 55c778e76dc8f056a8e58f05de0ec9ce792d92ee..bf74ec54be8fb8929c9c7ac5597572fa9204a586 100644
--- a/pkg/analyzer/lib/file_system/physical_file_system.dart
+++ b/pkg/analyzer/lib/file_system/physical_file_system.dart
@@ -22,6 +22,12 @@ class PhysicalResourceProvider implements ResourceProvider {
static final PhysicalResourceProvider INSTANCE =
new PhysicalResourceProvider._();
+ /**
+ * The name of the directory containing plugin specific subfolders used to
+ * store data across sessions.
+ */
+ static final String SERVER_DIR = "dartServer";
Paul Berry 2014/10/07 16:50:36 On Mac and Unix it's conventional to name these di
Brian Wilkerson 2014/10/07 16:57:51 Done
+
PhysicalResourceProvider._();
@override
@@ -37,6 +43,28 @@ class PhysicalResourceProvider implements ResourceProvider {
return new _PhysicalFile(file);
}
}
+
+ @override
+ Folder getStateLocation(String pluginId) {
+ String home;
+ if (io.Platform.isWindows) {
+ home = io.Platform.environment['LOCALAPPDATA'];
+ } else {
+ home = io.Platform.environment['HOME'];
+ }
+ if (home != null && io.FileSystemEntity.isDirectorySync(home)) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.write(home);
+ buffer.write(pathContext.separator);
+ buffer.write(SERVER_DIR);
+ buffer.write(pathContext.separator);
+ buffer.write(pluginId);
Paul Berry 2014/10/07 16:50:36 IMHO it reads a lot nicer to construct paths using
Brian Wilkerson 2014/10/07 16:57:51 Done
+ io.Directory directory = new io.Directory(buffer.toString());
+ directory.createSync(recursive: true);
+ return new _PhysicalFolder(directory);
+ }
+ return null;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698