improvements for NimScript support

This commit is contained in:
Araq 2015-09-03 14:11:33 +02:00
commit a373bdd0c9
3 changed files with 62 additions and 59 deletions

View file

@ -226,15 +226,7 @@ proc getSystemConfigPath(filename: string): string =
if not existsFile(result): result = "/etc/" & filename if not existsFile(result): result = "/etc/" & filename
proc loadConfigs*(cfg: string) = proc loadConfigs*(cfg: string) =
# set default value (can be overwritten): setDefaultLibpath()
if libpath == "":
# choose default libpath:
var prefix = getPrefixDir()
when defined(posix):
if prefix == "/usr": libpath = "/usr/lib/nim"
elif prefix == "/usr/local": libpath = "/usr/local/lib/nim"
else: libpath = joinPath(prefix, "lib")
else: libpath = joinPath(prefix, "lib")
if optSkipConfigFile notin gGlobalOptions: if optSkipConfigFile notin gGlobalOptions:
readConfigFile(getSystemConfigPath(cfg)) readConfigFile(getSystemConfigPath(cfg))

View file

@ -191,6 +191,17 @@ proc getPrefixDir*(): string =
else: else:
result = splitPath(getAppDir()).head result = splitPath(getAppDir()).head
proc setDefaultLibpath*() =
# set default value (can be overwritten):
if libpath == "":
# choose default libpath:
var prefix = getPrefixDir()
when defined(posix):
if prefix == "/usr": libpath = "/usr/lib/nim"
elif prefix == "/usr/local": libpath = "/usr/local/lib/nim"
else: libpath = joinPath(prefix, "lib")
else: libpath = joinPath(prefix, "lib")
proc canonicalizePath*(path: string): string = proc canonicalizePath*(path: string): string =
when not FileSystemCaseSensitive: result = path.expandFilename.toLower when not FileSystemCaseSensitive: result = path.expandFilename.toLower
else: result = path.expandFilename else: result = path.expandFilename

View file

@ -157,8 +157,8 @@ var
binDir*, backend*: string binDir*, backend*: string
skipDirs*, skipFiles*, skipExt*, installDirs*, installFiles*, skipDirs*, skipFiles*, skipExt*, installDirs*, installFiles*,
installExt*, bin*: seq[string] installExt*, bin*: seq[string] = @[]
requiresData*: seq[string] requiresData*: seq[string] = @[]
proc requires*(deps: varargs[string]) = proc requires*(deps: varargs[string]) =
for d in deps: requiresData.add(d) for d in deps: requiresData.add(d)