From a03c8f77adf871cbeac04797a4cc7c9932d66184 Mon Sep 17 00:00:00 2001 From: Seth Ladd Date: Mon, 16 May 2016 13:05:13 -0700 Subject: [PATCH] gracefully handle generating docs twice (#3939) * gracefully handle generating docs twice * silently handle if directory doesn't exist --- dev/tools/dartdoc.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dev/tools/dartdoc.dart b/dev/tools/dartdoc.dart index 742c6006bc..0557dd4190 100644 --- a/dev/tools/dartdoc.dart +++ b/dev/tools/dartdoc.dart @@ -89,6 +89,7 @@ dependencies: /// paths. Cleanup unused index.html files no longer needed. void createIndexAndCleanup() { print('\nCreating a custom index.html in $kDocRoot/index.html'); + removeOldFlutterDocsDir(); renameApiDir(); copyIndexToRootOfDocs(); addHtmlBaseToIndex(); @@ -96,6 +97,14 @@ void createIndexAndCleanup() { print('\nDocs ready to go!'); } +void removeOldFlutterDocsDir() { + try { + new Directory('$kDocRoot/flutter').deleteSync(recursive: true); + } catch(e) { + // If the directory does not exist, that's OK. + } +} + void renameApiDir() { new Directory('$kDocRoot/api').renameSync('$kDocRoot/flutter'); }