| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 compiler; | 5 library compiler; |
| 6 | 6 |
| 7 import 'dart:coreimpl'; | 7 import 'dart:coreimpl'; |
| 8 import 'package:html5lib/dom.dart'; | 8 import 'package:html5lib/dom.dart'; |
| 9 import 'package:html5lib/parser.dart'; | 9 import 'package:html5lib/parser.dart'; |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 Compiler(this.filesystem, this.options, [String currentDir]) { | 55 Compiler(this.filesystem, this.options, [String currentDir]) { |
| 56 _mainPath = new Path(options.inputFile); | 56 _mainPath = new Path(options.inputFile); |
| 57 var mainDir = _mainPath.directoryPath; | 57 var mainDir = _mainPath.directoryPath; |
| 58 var basePath = | 58 var basePath = |
| 59 options.baseDir != null ? new Path(options.baseDir) : mainDir; | 59 options.baseDir != null ? new Path(options.baseDir) : mainDir; |
| 60 var outputPath = | 60 var outputPath = |
| 61 options.outputDir != null ? new Path(options.outputDir) : mainDir; | 61 options.outputDir != null ? new Path(options.outputDir) : mainDir; |
| 62 | 62 |
| 63 // Normalize paths - all should be relative or absolute paths. | 63 // Normalize paths - all should be relative or absolute paths. |
| 64 if (_mainPath.isAbsolute || basePath.isAbsolute || outputPath.isAbsolute) { | 64 bool anyAbsolute = _mainPath.isAbsolute || basePath.isAbsolute || |
| 65 outputPath.isAbsolute; |
| 66 bool allAbsolute = _mainPath.isAbsolute && basePath.isAbsolute && |
| 67 outputPath.isAbsolute; |
| 68 if (anyAbsolute && !allAbsolute) { |
| 65 if (currentDir == null) { | 69 if (currentDir == null) { |
| 66 messages.error('internal error: could not normalize paths. Please make' | 70 messages.error('internal error: could not normalize paths. Please make ' |
| 67 'the input, base, and output paths all absolute or relative, or ' | 71 'the input, base, and output paths all absolute or relative, or ' |
| 68 'specify "currentDir" to the Compiler constructor', null); | 72 'specify "currentDir" to the Compiler constructor', null); |
| 69 return; | 73 return; |
| 70 } | 74 } |
| 71 var currentPath = new Path(currentDir); | 75 var currentPath = new Path(currentDir); |
| 72 if (!_mainPath.isAbsolute) _mainPath = currentPath.join(_mainPath); | 76 if (!_mainPath.isAbsolute) _mainPath = currentPath.join(_mainPath); |
| 73 if (!basePath.isAbsolute) basePath = currentPath.join(basePath); | 77 if (!basePath.isAbsolute) basePath = currentPath.join(basePath); |
| 74 if (!outputPath.isAbsolute) outputPath = currentPath.join(outputPath); | 78 if (!outputPath.isAbsolute) outputPath = currentPath.join(outputPath); |
| 75 } | 79 } |
| 76 _pathInfo = new PathInfo(basePath, outputPath); | 80 _pathInfo = new PathInfo(basePath, outputPath); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 if (doctype.tagName != 'html' || commentIndex != 1) { | 304 if (doctype.tagName != 'html' || commentIndex != 1) { |
| 301 messages.warning('file should start with <!DOCTYPE html> ' | 305 messages.warning('file should start with <!DOCTYPE html> ' |
| 302 'to avoid the possibility of it being parsed in quirks mode in IE. ' | 306 'to avoid the possibility of it being parsed in quirks mode in IE. ' |
| 303 'See http://www.w3.org/TR/html5-diff/#doctype', | 307 'See http://www.w3.org/TR/html5-diff/#doctype', |
| 304 doctype.span, file: file.path); | 308 doctype.span, file: file.path); |
| 305 } | 309 } |
| 306 } | 310 } |
| 307 document.nodes.insertAt(commentIndex, parseFragment( | 311 document.nodes.insertAt(commentIndex, parseFragment( |
| 308 '\n<!-- This file was auto-generated from template ${file.path}. -->\n')); | 312 '\n<!-- This file was auto-generated from template ${file.path}. -->\n')); |
| 309 } | 313 } |
| OLD | NEW |