Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Regression in Nimscript projectDir() behavior, returns empty string #9985
This is a very recent regression, probably related with the os paths refactoring.
Now it is returning an empty string.
proc getGitRootMaybe(): string = ## Try to get the path to the current git root directory. ## Return ``projectDir()`` if a ``.git`` directory is not found. const maxAttempts = 10 # arbitrarily picked var path = projectDir() # projectDir() needs nim 0.20.0 (or nim devel as of Tue Oct 16 08:41:09 EDT 2018) attempt = 0 while (attempt < maxAttempts) and (not existsDir(path / ".git")): path = path / "../" attempt += 1 if existsDir(path / ".git"): result = path else: result = projectDir()
I download that config.nims before running Travis tests for my elnim project. I run the tests every week (Travis cron) after building the latest Nim devel.
Today, that test started failing:
The error is "Error: invalid module name: .nim" because projectDir() returns "", and then this code in config.nims:
let root = getGitRootMaybe() (_, pkgName) = root.splitPath() srcFile = root / "src" / (pkgName & ".nim")
On locally building Nim devel f76bd06, I could recreate the same failing on doing
To recreate this error, simply add