Skip to content

Commit

Permalink
fix fileExists ambiguity for Nim < 1.4 & bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Vindaar committed Jul 4, 2023
1 parent eb9a7ad commit dd92f8e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nimcuda.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.1.8"
version = "0.1.9"
author = "Andrea Ferretti"
description = "Nim binding for CUDA"
license = "Apache2"
Expand All @@ -12,6 +12,12 @@ requires "nim >= 0.16.0"

import os, strutils

proc fExists(f: string): bool =
when (NimMajor, NimMinor) < (1, 4):
result = os.fileExists(f)
else:
result = fileExists(f)

proc patch(libName: string): string =
when defined(windows):
let libpath = getEnv("CUDA_PATH") / "include" / libName
Expand All @@ -23,7 +29,7 @@ proc patch(libName: string): string =
patchPath = "c2nim" / libName
outPath = "headers" / libName
libContent =
if fileExists(simpleLibPath): readFile(simpleLibPath)
if fExists(simpleLibPath): readFile(simpleLibPath)
else: readFile(libPath) #.replace("#if defined(__cplusplus)", "#ifdef __cplusplus")
patchContent = readFile(patchPath)
writeFile(outPath, patchContent & libContent)
Expand Down

0 comments on commit dd92f8e

Please sign in to comment.