Commit a03c8f77 authored by Seth Ladd's avatar Seth Ladd

gracefully handle generating docs twice (#3939)

* gracefully handle generating docs twice

* silently handle if directory doesn't exist
parent 32527017
...@@ -89,6 +89,7 @@ dependencies: ...@@ -89,6 +89,7 @@ dependencies:
/// paths. Cleanup unused index.html files no longer needed. /// paths. Cleanup unused index.html files no longer needed.
void createIndexAndCleanup() { void createIndexAndCleanup() {
print('\nCreating a custom index.html in $kDocRoot/index.html'); print('\nCreating a custom index.html in $kDocRoot/index.html');
removeOldFlutterDocsDir();
renameApiDir(); renameApiDir();
copyIndexToRootOfDocs(); copyIndexToRootOfDocs();
addHtmlBaseToIndex(); addHtmlBaseToIndex();
...@@ -96,6 +97,14 @@ void createIndexAndCleanup() { ...@@ -96,6 +97,14 @@ void createIndexAndCleanup() {
print('\nDocs ready to go!'); 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() { void renameApiDir() {
new Directory('$kDocRoot/api').renameSync('$kDocRoot/flutter'); new Directory('$kDocRoot/api').renameSync('$kDocRoot/flutter');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment