summary refs log tree commit diff stats
path: root/compiler/nim.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-09-07 01:53:09 +0200
committerAraq <rumpf_a@web.de>2018-09-07 19:21:16 +0200
commit86556ebfdbbd4b8e9edc9d3085ea21d6c0bae2e2 (patch)
tree9f8b4b752ed728ceff82dceef2f5605cb2a846a0 /compiler/nim.nim
parentb5730ec01f02e542eb06161430aa5a7c2ede775f (diff)
downloadNim-86556ebfdbbd4b8e9edc9d3085ea21d6c0bae2e2.tar.gz
compiler refactoring; use typesafe path handing; docgen: render symbols between modules
Diffstat (limited to 'compiler/nim.nim')
-rw-r--r--compiler/nim.nim17
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/nim.nim b/compiler/nim.nim
index 0fed72dc7..bab1949b5 100644
--- a/compiler/nim.nim
+++ b/compiler/nim.nim
@@ -21,7 +21,8 @@ when defined(i386) and defined(windows) and defined(vcc):
 import
   commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes,
   extccomp, strutils, os, osproc, platform, main, parseopt,
-  nodejs, scriptconfig, idents, modulegraphs, lineinfos, cmdlinehelper
+  nodejs, scriptconfig, idents, modulegraphs, lineinfos, cmdlinehelper,
+  pathutils
 
 when hasTinyCBackend:
   import tccgen
@@ -30,12 +31,12 @@ when defined(profiler) or defined(memProfiler):
   {.hint: "Profiling support is turned on!".}
   import nimprof
 
-proc prependCurDir(f: string): string =
+proc prependCurDir(f: AbsoluteFile): AbsoluteFile =
   when defined(unix):
-    if os.isAbsolute(f): result = f
-    else: result = "./" & f
+    if os.isAbsolute(f.string): result = f
+    else: result = AbsoluteFile("./" & f.string)
   else:
-    result = f
+    result = AbsoluteFile f
 
 proc processCmdLine(pass: TCmdLinePass, cmd: string; config: ConfigRef) =
   var p = parseopt.initOptParser(cmd)
@@ -78,15 +79,15 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
   if optRun in conf.globalOptions:
     if conf.cmd == cmdCompileToJS:
       var ex: string
-      if conf.outFile.len > 0:
+      if not conf.outFile.isEmpty:
         ex = conf.outFile.prependCurDir.quoteShell
       else:
         ex = quoteShell(
           completeCFilePath(conf, changeFileExt(conf.projectFull, "js").prependCurDir))
       execExternalProgram(conf, findNodeJs() & " " & ex & ' ' & conf.arguments)
     else:
-      var binPath: string
-      if conf.outFile.len > 0:
+      var binPath: AbsoluteFile
+      if not conf.outFile.isEmpty:
         # If the user specified an outFile path, use that directly.
         binPath = conf.outFile.prependCurDir
       else: