fix the unused warnings on windows (#17073)

This commit is contained in:
flywind 2021-02-17 12:24:27 -06:00 • committed by GitHub
commit 98102605d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,7 +41,7 @@
## * `dynlib module <dynlib.html>`_ ## * `dynlib module <dynlib.html>`_
## * `streams module <streams.html>`_ ## * `streams module <streams.html>`_
include "system/inclrtl" include system/inclrtl
import std/private/since import std/private/since
import std/[strutils, pathnorm] import std/[strutils, pathnorm]
@ -1095,10 +1095,12 @@ when defined(windows) or defined(posix) or defined(nintendoswitch):
result.add quoteShell(args[i]) result.add quoteShell(args[i])
when not weirdTarget: when not weirdTarget:
proc c_rename(oldname, newname: cstring): cint {.
importc: "rename", header: "<stdio.h>".}
proc c_system(cmd: cstring): cint {. proc c_system(cmd: cstring): cint {.
importc: "system", header: "<stdlib.h>".} importc: "system", header: "<stdlib.h>".}
when not defined(windows):
proc c_rename(oldname, newname: cstring): cint {.
importc: "rename", header: "<stdio.h>".}
proc c_strlen(a: cstring): cint {. proc c_strlen(a: cstring): cint {.
importc: "strlen", header: "<string.h>", noSideEffect.} importc: "strlen", header: "<string.h>", noSideEffect.}
proc c_free(p: pointer) {. proc c_free(p: pointer) {.
@ -1193,8 +1195,11 @@ proc symlinkExists*(link: string): bool {.rtl, extern: "nos$1",
var res: Stat var res: Stat
return lstat(link, res) >= 0'i32 and S_ISLNK(res.st_mode) return lstat(link, res) >= 0'i32 and S_ISLNK(res.st_mode)
when not defined(windows):
const maxSymlinkLen = 1024
const const
maxSymlinkLen = 1024
ExeExts* = ## Platform specific file extension for executables. ExeExts* = ## Platform specific file extension for executables.
## On Windows ``["exe", "cmd", "bat"]``, on Posix ``[""]``. ## On Windows ``["exe", "cmd", "bat"]``, on Posix ``[""]``.
when defined(windows): ["exe", "cmd", "bat"] else: [""] when defined(windows): ["exe", "cmd", "bat"] else: [""]