Chromium Code Reviews| 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; |
| + } |
| } |