Skip to content

Instantly share code, notes, and snippets.

@singularperturbation
Created January 28, 2018 18:42
Show Gist options
  • Save singularperturbation/317b5439c4f3e4c78d62523a10eb72f4 to your computer and use it in GitHub Desktop.
Save singularperturbation/317b5439c4f3e4c78d62523a10eb72f4 to your computer and use it in GitHub Desktop.
Read version (or other info) at compile time
import os
import strutils
template getPath(): string =
const path = instantiationInfo(fullPaths = true)
splitFile(path.filename).dir & DirSep
const versionFile = getPath() & "version.txt"
const version = slurp(versionFile).strip()
echo version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment