fixes #10042 (allow spaces in import) (#10504)

This allows spaces in imports, by using the following syntax:
* `import "directory with spaces" / subdir / file`, or
* `import "directory with spaces/subdir/file"`
This commit is contained in:
Miran
2019-01-31 08:20:00 +01:00
committed by Andreas Rumpf
parent 81e5a35d56
commit fa058773db
3 changed files with 5 additions and 1 deletions

View File

@@ -114,7 +114,6 @@ proc getModuleName*(conf: ConfigRef; n: PNode): string =
try:
result =
pathSubs(conf, n.strVal, toFullPath(conf, n.info).splitFile().dir)
.replace(" ")
except ValueError:
localError(conf, n.info, "invalid path: " & n.strVal)
result = n.strVal

View File

@@ -0,0 +1 @@
proc tenTimes*(x: int): int = 10*x

View File

@@ -2,5 +2,9 @@ discard """
output: "Successful"
"""
# Test for the compiler to be able to compile a Nim file with spaces in the directory name.
# Also test if import of a directory with a space works.
import "more spaces" / mspace
assert tenTimes(5) == 50
echo("Successful")