Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library('file_system_node'); | 5 #library('file_system_node'); |
| 6 | 6 |
| 7 #import('file_system.dart'); | 7 #import('file_system.dart'); |
| 8 #import('lib/node/node.dart'); | 8 #import('lib/node/node.dart'); |
| 9 | 9 |
| 10 /** File system implementation using nodejs api's (for self-hosted compiler). */ | 10 /** File system implementation using nodejs api's (for self-hosted compiler). */ |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 | 36 |
| 37 try { | 37 try { |
| 38 final stat = fs.statSync(subpath); | 38 final stat = fs.statSync(subpath); |
| 39 | 39 |
| 40 if (stat.isDirectory()) { | 40 if (stat.isDirectory()) { |
| 41 existing = subpath; | 41 existing = subpath; |
| 42 } else { | 42 } else { |
| 43 throw 'Cannot create directory $path because $existing exists and ' + | 43 throw 'Cannot create directory $path because $existing exists and ' + |
| 44 'is not a directory.'; | 44 'is not a directory.'; |
| 45 } | 45 } |
| 46 } catch (e) { | 46 } catch (var e) { |
|
Jennifer Messerly
2011/12/20 22:28:15
Is this just a style change, or did the compiler n
terry
2011/12/20 22:50:40
I did this because DartC errors if no var and I wr
| |
| 47 // Ugly hack. We only want to catch ENOENT exceptions from fs.statSync | 47 // Ugly hack. We only want to catch ENOENT exceptions from fs.statSync |
| 48 // which means the path we're trying doesn't exist. Since this is coming | 48 // which means the path we're trying doesn't exist. Since this is coming |
| 49 // from node, we can't check the exception's type. | 49 // from node, we can't check the exception's type. |
| 50 if (e.toString().indexOf('ENOENT') != -1) break; | 50 if (e.toString().indexOf('ENOENT') != -1) break; |
| 51 | 51 |
| 52 // Re-throw any other exceptions. | 52 // Re-throw any other exceptions. |
| 53 throw e; | 53 throw e; |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 74 } else if (stat.isFile()) { | 74 } else if (stat.isFile()) { |
| 75 // Try to remove the file. | 75 // Try to remove the file. |
| 76 fs.unlinkSync(subpath); | 76 fs.unlinkSync(subpath); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 fs.rmdirSync(path); | 81 fs.rmdirSync(path); |
| 82 } | 82 } |
| 83 } | 83 } |
| OLD | NEW |