gracefully handle generating docs twice (#3939)

* gracefully handle generating docs twice

* silently handle if directory doesn't exist
This commit is contained in:
Seth Ladd 2016-05-16 13:05:13 -07:00
parent 3252701753
commit a03c8f77ad

View File

@ -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');
}