Fixes compilation on Windows.
This commit is contained in:
parent
bc6ce4b9ea
commit
84d63c8988
2 changed files with 21 additions and 22 deletions
|
|
@ -17,24 +17,6 @@ import nimblepkg/packageinfo, nimblepkg/version, nimblepkg/tools,
|
||||||
|
|
||||||
import nimblepkg/nimscriptsupport
|
import nimblepkg/nimscriptsupport
|
||||||
|
|
||||||
when not defined(windows):
|
|
||||||
from posix import getpid
|
|
||||||
else:
|
|
||||||
# This is just for Win XP support.
|
|
||||||
# TODO: Drop XP support?
|
|
||||||
from winlean import WINBOOL, DWORD
|
|
||||||
type
|
|
||||||
OSVERSIONINFO* {.final, pure.} = object
|
|
||||||
dwOSVersionInfoSize*: DWORD
|
|
||||||
dwMajorVersion*: DWORD
|
|
||||||
dwMinorVersion*: DWORD
|
|
||||||
dwBuildNumber*: DWORD
|
|
||||||
dwPlatformId*: DWORD
|
|
||||||
szCSDVersion*: array[0..127, char]
|
|
||||||
|
|
||||||
proc GetVersionExA*(VersionInformation: var OSVERSIONINFO): WINBOOL{.stdcall,
|
|
||||||
dynlib: "kernel32", importc: "GetVersionExA".}
|
|
||||||
|
|
||||||
proc refresh(options: Options) =
|
proc refresh(options: Options) =
|
||||||
## Downloads the package list from the specified URL.
|
## Downloads the package list from the specified URL.
|
||||||
##
|
##
|
||||||
|
|
@ -378,7 +360,7 @@ proc removePkgDir(dir: string, options: Options) =
|
||||||
for bin in pkgInfo.bin:
|
for bin in pkgInfo.bin:
|
||||||
let symlinkDest = pkgInfo.getRealDir() / bin
|
let symlinkDest = pkgInfo.getRealDir() / bin
|
||||||
let symlinkFilename = options.getBinDir() / bin.extractFilename
|
let symlinkFilename = options.getBinDir() / bin.extractFilename
|
||||||
discard setupBinSymlink(symlinkDest, symlinkFilename)
|
discard setupBinSymlink(symlinkDest, symlinkFilename, options)
|
||||||
else:
|
else:
|
||||||
display("Warning:", ("Cannot completely remove $1. Binary symlinks may " &
|
display("Warning:", ("Cannot completely remove $1. Binary symlinks may " &
|
||||||
"have been left over in $2.") %
|
"have been left over in $2.") %
|
||||||
|
|
@ -491,7 +473,7 @@ proc installFromDir(dir: string, requestedVer: VersionRange, options: Options,
|
||||||
# Set up a symlink.
|
# Set up a symlink.
|
||||||
let symlinkDest = pkgDestDir / bin
|
let symlinkDest = pkgDestDir / bin
|
||||||
let symlinkFilename = binDir / bin.extractFilename
|
let symlinkFilename = binDir / bin.extractFilename
|
||||||
for filename in setupBinSymlink(symlinkDest, symlinkFilename):
|
for filename in setupBinSymlink(symlinkDest, symlinkFilename, options):
|
||||||
binariesInstalled.incl(filename)
|
binariesInstalled.incl(filename)
|
||||||
|
|
||||||
let vcsRevision = vcsRevisionInDir(realDir)
|
let vcsRevision = vcsRevisionInDir(realDir)
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,26 @@
|
||||||
import os, strutils
|
import os, strutils
|
||||||
|
|
||||||
# Local imports
|
# Local imports
|
||||||
import cli
|
import cli, common, options
|
||||||
|
|
||||||
proc setupBinSymlink*(symlinkDest, symlinkFilename: string): seq[string] =
|
when defined(windows):
|
||||||
|
# This is just for Win XP support.
|
||||||
|
# TODO: Drop XP support?
|
||||||
|
from winlean import WINBOOL, DWORD
|
||||||
|
type
|
||||||
|
OSVERSIONINFO* {.final, pure.} = object
|
||||||
|
dwOSVersionInfoSize*: DWORD
|
||||||
|
dwMajorVersion*: DWORD
|
||||||
|
dwMinorVersion*: DWORD
|
||||||
|
dwBuildNumber*: DWORD
|
||||||
|
dwPlatformId*: DWORD
|
||||||
|
szCSDVersion*: array[0..127, char]
|
||||||
|
|
||||||
|
proc GetVersionExA*(VersionInformation: var OSVERSIONINFO): WINBOOL{.stdcall,
|
||||||
|
dynlib: "kernel32", importc: "GetVersionExA".}
|
||||||
|
|
||||||
|
proc setupBinSymlink*(symlinkDest, symlinkFilename: string,
|
||||||
|
options: Options): seq[string] =
|
||||||
result = @[]
|
result = @[]
|
||||||
let currentPerms = getFilePermissions(symlinkDest)
|
let currentPerms = getFilePermissions(symlinkDest)
|
||||||
setFilePermissions(symlinkDest, currentPerms + {fpUserExec})
|
setFilePermissions(symlinkDest, currentPerms + {fpUserExec})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue