summary refs log tree commit diff stats
path: root/compiler/main.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main.nim')
-rw-r--r--compiler/main.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index 282f7d814..154252bf3 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -63,7 +63,9 @@ proc commandCheck(graph: ModuleGraph) =
 
 when not defined(leanCompiler):
   proc commandDoc2(graph: ModuleGraph; json: bool) =
-    graph.config.outDir = AbsoluteDir(graph.config.outDir / graph.config.outFile)
+    if optWholeProject in graph.config.globalOptions:
+      # Backward compatibility with previous versions
+      graph.config.outDir = AbsoluteDir(graph.config.outDir / graph.config.outFile)
     graph.config.errorMax = high(int)  # do not stop after first error
     semanticPasses(graph)
     if json: registerPass(graph, docgen2JsonPass)