summary refs log tree commit diff stats
path: root/compiler/options.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-05-31 03:04:36 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-05-31 03:04:45 +0200
commit893be3a5a40cbbceb211efe47361632ccdbed227 (patch)
treefc7d1eae670fd6703b06022d2d836a6b40f68c75 /compiler/options.nim
parent1e5926458c2d18dec3389d00f41680518fb939c0 (diff)
downloadNim-893be3a5a40cbbceb211efe47361632ccdbed227.tar.gz
changed the compiler's path handling; fixes #546
Diffstat (limited to 'compiler/options.nim')
-rw-r--r--compiler/options.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/options.nim b/compiler/options.nim
index 2716a98d3..3ef6c6c46 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -242,6 +242,21 @@ proc getNimcacheDir*: string =
   result = if nimcacheDir.len > 0: nimcacheDir else: gProjectPath.shortenDir /
                                                          genSubDir
 
+
+proc pathSubs*(p, config: string): string =
+  let home = removeTrailingDirSep(os.getHomeDir())
+  result = unixToNativePath(p % [
+    "nim", getPrefixDir(),
+    "lib", libpath,
+    "home", home,
+    "config", config,
+    "projectname", options.gProjectName,
+    "projectpath", options.gProjectPath,
+    "projectdir", options.gProjectPath,
+    "nimcache", getNimcacheDir()])
+  if '~' in result:
+    result = result.replace("~", home)
+
 template newPackageCache(): expr =
   newStringTable(when FileSystemCaseSensitive:
                    modeCaseInsensitive