1
0
mirror of https://github.com/tiyn/yeschess.git synced 2026-02-22 10:34:47 +01:00

configs and projectPath

In the last few commits the problem occured
that absolute paths are needed for correct
and unambiguous locations for binary files
or the database.
For the compiler arguments the problem is now
solved with an automatic script, that creates
the absolute paths automatically for different
systems.
The database path is now specified by calling
a new function, that finds the root of the
project followed by a relative path.
This commit is contained in:
TiynGER
2021-05-17 00:01:18 +02:00
parent fa05c87cb1
commit ca73df4fbb
10 changed files with 92 additions and 29 deletions

View File

@@ -2,7 +2,7 @@ import nimpy
import asyncnet, asyncdispatch
import chess
import secret
import engine/secret
import engine/engine
let berserk = pyImport("berserk")

View File

@@ -1 +0,0 @@
--outdir:"../../bin/src"

View File

@@ -3,10 +3,12 @@ import sequtils
import strutils
import sugar
import tables
import os
include chess
import secret
import project
type
BookMove* = object
@@ -20,7 +22,7 @@ type
rating*: int # `rating` is the average rating of the player to move.
let dbConn = projectdir & "src/engine/openings.db"
let dbConn = joinPath(getProjRootDir(), "ressources/openings.db")
let dbUser = ""
let dbPasswd = ""
let dbName = ""

View File

@@ -1,2 +0,0 @@
--outdir:"../bin/src"
--path:"."

15
src/project.nim Normal file
View File

@@ -0,0 +1,15 @@
import os
proc getProjRootDir*(): string =
## Returns the root directory for the ychess project.
var maxDepth = 4
var path = os.getCurrentDir()
var projectDir: string
while maxDepth > 0:
if dirExists(joinPath(path, "src")):
projectDir = path
break
else:
path = parentDir(path)
maxDepth -= 1
return projectDir