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

Unified Diff: frog/file_system_dom.dart

Issue 10548047: Remove frog from the repository. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move test and update apidoc.gyp. Created 8 years, 6 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
« no previous file with comments | « frog/file_system.dart ('k') | frog/file_system_memory.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/file_system_dom.dart
diff --git a/frog/file_system_dom.dart b/frog/file_system_dom.dart
deleted file mode 100644
index 8887dac3c9aa356da72e110b0c2d6f8667b19fb4..0000000000000000000000000000000000000000
--- a/frog/file_system_dom.dart
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-#library('file_system_dom');
-
-#import('dart:dom_deprecated');
-#import('file_system.dart');
-
-/**
- * [FileSystem] implementation using XHRs for reading files and an in memory
- * cache for writing them.
- */
-class DomFileSystem implements FileSystem {
- Map<String, String> _fileCache;
- String _path;
-
- DomFileSystem([this._path = null]) : _fileCache = {};
-
- // TODO(vsm): Move this to FileSystem.
- String absPath(String filename) {
- if (_path != null && !filename.startsWith('/')
- && !filename.startsWith('file:///') && !filename.startsWith('http://')
- && !filename.startsWith('dart:')) {
- filename = joinPaths(_path, filename);
- }
- return filename;
- }
-
- String readAll(String filename) {
- filename = absPath(filename);
- var result = _fileCache[filename];
- if (result == null) {
- final xhr = new XMLHttpRequest();
- // TODO(jimhug): Fix API so we can get multiple files at once.
- // Use a sychronous XHR to match the current API.
- xhr.open('GET', filename, false);
- try {
- xhr.send(null);
- } catch (var e) {
- // TODO(vsm): This XHR appears to fail if the URL is a
- // directory. Return something to make fileExists work.
- // Handle this better.
- return "_directory($filename)_";
- }
-
- if (xhr.status == 0 || xhr.status == 200) {
- result = xhr.responseText;
- if (result.isEmpty()) {
- // TODO(vsm): Figure out why a non-existent file is not giving
- // an error code.
- print('Error: $filename is not found or empty');
- return null;
- }
- } else {
- // TODO(jimhug): Better error handling.
- print("Error: ${xhr.statusText}");
- }
- _fileCache[filename] = result;
- }
- return result;
- }
-
- void writeString(String outfile, String text) {
- outfile = absPath(outfile);
- _fileCache[outfile] = text;
- }
-
- // Note: this is not a perf nightmare only because of caching.
- bool fileExists(String filename) => readAll(filename) != null;
-
- void createDirectory(String path, [bool recursive = false]) {
- // TODO(rnystrom): Implement.
- throw 'createDirectory() is not implemented by DomFileSystem yet.';
- }
-
- void removeDirectory(String path, [bool recursive = false]) {
- // TODO(rnystrom): Implement.
- throw 'removeDirectory() is not implemented by DomFileSystem yet.';
- }
-}
« no previous file with comments | « frog/file_system.dart ('k') | frog/file_system_memory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698