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:
parent
81e5a35d56
commit
fa058773db
3 changed files with 5 additions and 1 deletions
|
|
@ -114,7 +114,6 @@ proc getModuleName*(conf: ConfigRef; n: PNode): string =
|
||||||
try:
|
try:
|
||||||
result =
|
result =
|
||||||
pathSubs(conf, n.strVal, toFullPath(conf, n.info).splitFile().dir)
|
pathSubs(conf, n.strVal, toFullPath(conf, n.info).splitFile().dir)
|
||||||
.replace(" ")
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
localError(conf, n.info, "invalid path: " & n.strVal)
|
localError(conf, n.info, "invalid path: " & n.strVal)
|
||||||
result = n.strVal
|
result = n.strVal
|
||||||
|
|
|
||||||
1
tests/dir with space/more spaces/mspace.nim
Normal file
1
tests/dir with space/more spaces/mspace.nim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
proc tenTimes*(x: int): int = 10*x
|
||||||
|
|
@ -2,5 +2,9 @@ discard """
|
||||||
output: "Successful"
|
output: "Successful"
|
||||||
"""
|
"""
|
||||||
# Test for the compiler to be able to compile a Nim file with spaces in the directory name.
|
# 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")
|
echo("Successful")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue