Skip to content

Commit cc757e0

Browse files
Accept empty output directories, see #118
1 parent 4b29db8 commit cc757e0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

bin/typedoc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7201,6 +7201,13 @@ var td;
72017201
*/
72027202
Renderer.prototype.prepareOutputDirectory = function (directory) {
72037203
if (td.FS.existsSync(directory)) {
7204+
if (!td.FS.statSync(directory).isDirectory()) {
7205+
this.application.logger.error('The output target "%s" exists but it is not a directory.', directory);
7206+
return false;
7207+
}
7208+
if (td.FS.readdirSync(directory).length == 0) {
7209+
return true;
7210+
}
72047211
if (!this.theme.isOutputDirectory(directory)) {
72057212
this.application.logger.error('The output directory "%s" exists but does not seem to be a documentation generated by TypeDoc.\n' +
72067213
'Make sure this is the right target directory, delete the folder and rerun TypeDoc.', directory);

src/td/output/Renderer.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,17 @@ module td.output
258258
*/
259259
private prepareOutputDirectory(directory:string):boolean {
260260
if (FS.existsSync(directory)) {
261+
if (!FS.statSync(directory).isDirectory()) {
262+
this.application.logger.error(
263+
'The output target "%s" exists but it is not a directory.',
264+
directory);
265+
return false;
266+
}
267+
268+
if (FS.readdirSync(directory).length == 0) {
269+
return true;
270+
}
271+
261272
if (!this.theme.isOutputDirectory(directory)) {
262273
this.application.logger.error(
263274
'The output directory "%s" exists but does not seem to be a documentation generated by TypeDoc.\n' +

0 commit comments

Comments
 (0)