From 4ffcdf141e880422ccbc02b9f33eff161a7031d0 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Thu, 4 Jun 2015 18:33:38 +0100 Subject: [PATCH] Fix installation (default output dir changed). --- src/nimble.nim | 5 +++-- src/nimblepkg/packageinfo.nim | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nimble.nim b/src/nimble.nim index 8bdbe05..4e7cb1c 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -464,7 +464,7 @@ proc buildFromDir(pkgInfo: PackageInfo, paths: seq[string], forRelease: bool) = var args = "" for path in paths: args.add("--path:\"" & path & "\" ") for bin in pkgInfo.bin: - let outputOpt = pkgInfo.getOutputOption(bin) + let outputOpt = "-o:\"" & pkgInfo.getOutputDir(bin) & "\"" echo("Building ", pkginfo.name, "/", bin, " using ", pkgInfo.backend, " backend...") doCmd(getNimBin() & " $# $# --noBabelPath $# $# \"$#\"" % @@ -553,7 +553,8 @@ proc installFromDir(dir: string, latest: bool, options: Options, # and symlink them on *nix OS' to $nimbleDir/bin/ for bin in pkgInfo.bin: if not existsFile(pkgDestDir / bin): - filesInstalled.incl copyFileD(realDir / bin, pkgDestDir / bin) + filesInstalled.incl copyFileD(pkgInfo.getOutputDir(bin), + pkgDestDir / bin) let currentPerms = getFilePermissions(pkgDestDir / bin) setFilePermissions(pkgDestDir / bin, currentPerms + {fpUserExec}) diff --git a/src/nimblepkg/packageinfo.nim b/src/nimblepkg/packageinfo.nim index 65f0aa9..c58e32d 100644 --- a/src/nimblepkg/packageinfo.nim +++ b/src/nimblepkg/packageinfo.nim @@ -329,13 +329,12 @@ proc getRealDir*(pkgInfo: PackageInfo): string = else: result = pkgInfo.mypath.splitFile.dir -proc getOutputOption*(pkgInfo: PackageInfo, bin: string): string = - ## Returns an output option for the nim compiler if a build directory - ## has been set. +proc getOutputDir*(pkgInfo: PackageInfo, bin: string): string = + ## Returns a binary output dir for the package. if pkgInfo.binDir != "": - result = " -o:\"" & pkgInfo.mypath.splitFile.dir / pkgInfo.binDir / bin & "\"" + result = pkgInfo.mypath.splitFile.dir / pkgInfo.binDir / bin else: - result = " -o:\"" & pkgInfo.mypath.splitFile.dir / bin & "\"" + result = pkgInfo.mypath.splitFile.dir / bin proc getNameVersion*(pkgpath: string): tuple[name, version: string] = ## Splits ``pkgpath`` in the format ``/home/user/.nimble/pkgs/package-0.1``