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

Side by Side Diff: pkg/analysis_server/tool/spec/codegen_tools.dart

Issue 469253006: Ignore hidden files in implementation of GeneratedDirectory.check() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 5 /**
6 * Tools for code generation. 6 * Tools for code generation.
7 */ 7 */
8 library codegen.tools; 8 library codegen.tools;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 Map<String, FileContentsComputer> map = directoryContentsComputer(); 404 Map<String, FileContentsComputer> map = directoryContentsComputer();
405 try { 405 try {
406 map.forEach((String file, FileContentsComputer fileContentsComputer) { 406 map.forEach((String file, FileContentsComputer fileContentsComputer) {
407 String expectedContents = fileContentsComputer(); 407 String expectedContents = fileContentsComputer();
408 File outputFile = 408 File outputFile =
409 new File(joinAll(posix.split(posix.join(outputDirPath, file)))); 409 new File(joinAll(posix.split(posix.join(outputDirPath, file))));
410 if (expectedContents != outputFile.readAsStringSync()) { 410 if (expectedContents != outputFile.readAsStringSync()) {
411 return false; 411 return false;
412 } 412 }
413 }); 413 });
414 if (outputFile.listSync().length != map.length) { 414 int nonHiddenFileCount = 0;
415 outputFile.listSync(
416 recursive: false,
417 followLinks: false).forEach((FileSystemEntity fileSystemEntity) {
418 if(fileSystemEntity is File && !posix.split(fileSystemEntity.path).last .startsWith('.')) {
Paul Berry 2014/08/18 20:56:41 Don't use "posix."--this needs to work on Windows.
jwren 2014/08/18 21:06:29 Done.
419 nonHiddenFileCount++;
420 }
421 });
422 if (nonHiddenFileCount != map.length) {
415 // The number of files generated doesn't match the number we expected to 423 // The number of files generated doesn't match the number we expected to
416 // generate. 424 // generate.
417 return false; 425 return false;
418 } 426 }
419 } catch (e) { 427 } catch (e) {
420 // There was a problem reading the file (most likely because it didn't 428 // There was a problem reading the file (most likely because it didn't
421 // exist). Treat that the same as if the file doesn't have the expected 429 // exist). Treat that the same as if the file doesn't have the expected
422 // contents. 430 // contents.
423 return false; 431 return false;
424 } 432 }
(...skipping 18 matching lines...) Expand all
443 outputFile.createSync(recursive: true); 451 outputFile.createSync(recursive: true);
444 452
445 // generate all of the files in the directory 453 // generate all of the files in the directory
446 Map<String, FileContentsComputer> map = directoryContentsComputer(); 454 Map<String, FileContentsComputer> map = directoryContentsComputer();
447 map.forEach((String file, FileContentsComputer fileContentsComputer) { 455 map.forEach((String file, FileContentsComputer fileContentsComputer) {
448 File outputFile = new File(joinAll(posix.split(outputDirPath + file))); 456 File outputFile = new File(joinAll(posix.split(outputDirPath + file)));
449 outputFile.writeAsStringSync(fileContentsComputer()); 457 outputFile.writeAsStringSync(fileContentsComputer());
450 }); 458 });
451 } 459 }
452 } 460 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698