Let the environment variable NIMBLE_DIR overrides nimblepath in cfg file (#6542)
* Let the environment variable NIMBLE_DIR overrides nimblepath in cfg file If the length of NIMBLE_DIR is larger than zero, the nimblepath will be set to $NIMBLE_DIR/pkgs
This commit is contained in:
parent
93fd0b0cb5
commit
616db85c61
3 changed files with 8 additions and 3 deletions
|
|
@ -343,7 +343,9 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
# keep the old name for compat
|
# keep the old name for compat
|
||||||
if pass in {passCmd2, passPP} and not options.gNoNimblePath:
|
if pass in {passCmd2, passPP} and not options.gNoNimblePath:
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
let path = processPath(arg, info, notRelativeToProj=true)
|
var path = processPath(arg, info, notRelativeToProj=true)
|
||||||
|
let nimbleDir = getEnv("NIMBLE_DIR")
|
||||||
|
if nimbleDir.len > 0 and pass == passPP: path = nimbleDir / "pkgs"
|
||||||
nimblePath(path, info)
|
nimblePath(path, info)
|
||||||
of "nonimblepath", "nobabelpath":
|
of "nonimblepath", "nobabelpath":
|
||||||
expectNoArg(switch, arg, pass, info)
|
expectNoArg(switch, arg, pass, info)
|
||||||
|
|
|
||||||
|
|
@ -324,9 +324,10 @@ type PackageFilter = enum
|
||||||
pfExtraOnly
|
pfExtraOnly
|
||||||
pfAll
|
pfAll
|
||||||
|
|
||||||
|
var nimbleDir = getEnv("NIMBLE_DIR").string
|
||||||
|
if nimbleDir.len == 0: nimbleDir = getHomeDir() / ".nimble"
|
||||||
let
|
let
|
||||||
nimbleExe = findExe("nimble")
|
nimbleExe = findExe("nimble")
|
||||||
nimbleDir = getHomeDir() / ".nimble"
|
|
||||||
packageDir = nimbleDir / "pkgs"
|
packageDir = nimbleDir / "pkgs"
|
||||||
packageIndex = nimbleDir / "packages.json"
|
packageIndex = nimbleDir / "packages.json"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,9 @@ proc resolve(t: Task) =
|
||||||
|
|
||||||
when considerNimbleDirs:
|
when considerNimbleDirs:
|
||||||
if not t.noNimblePath:
|
if not t.noNimblePath:
|
||||||
if findInNimbleDir(t, getHomeDir() / ".nimble" / "pkgs"): return
|
var nimbleDir = getEnv("NIMBLE_DIR")
|
||||||
|
if nimbleDir.len == 0: nimbleDir = getHomeDir() / ".nimble"
|
||||||
|
if findInNimbleDir(t, nimbleDir / "pkgs"): return
|
||||||
when not defined(windows):
|
when not defined(windows):
|
||||||
if findInNimbleDir(t, "/opt/nimble/pkgs"): return
|
if findInNimbleDir(t, "/opt/nimble/pkgs"): return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue