mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
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:
@@ -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
|
||||
|
||||
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"
|
||||
"""
|
||||
# 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")
|
||||
|
||||
Reference in New Issue
Block a user