add getCurrentCompilerExe to vmops (eg allows to get nim compiler at CT); add tests for vmops (#9925)

This commit is contained in:
Timothee Cour 2018-12-18 00:07:12 -08:00 • committed by Andreas Rumpf
commit c4e3c4ca2d
6 changed files with 65 additions and 2 deletions

View file

@ -1419,6 +1419,12 @@ type
pcDir, ## path refers to a directory
pcLinkToDir ## path refers to a symbolic link to a directory
proc getCurrentCompilerExe*(): string {.compileTime.} = discard
## `getAppFilename` at CT; can be used to retrive the currently executing
## Nim compiler from a Nim or nimscript program, or the nimble binary
## inside a nimble program (likewise with other binaries built from
## compiler API).
when defined(posix) and not defined(nimscript):
proc getSymlinkFileKind(path: string): PathComponent =
# Helper function.
@ -2118,7 +2124,8 @@ when defined(haiku):
result = ""
proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect], noNimScript.} =
## Returns the filename of the application's executable.
## Returns the filename of the application's executable. See also
## `getCurrentCompilerExe`.
##
## This procedure will resolve symlinks.