fix setCommand so it behaves like regular nim invocation (#18555)
This commit is contained in:
parent
01fc9e58ca
commit
d5b5827bc2
3 changed files with 12 additions and 18 deletions
|
|
@ -695,6 +695,16 @@ proc setDefaultLibpath*(conf: ConfigRef) =
|
|||
proc canonicalizePath*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile =
|
||||
result = AbsoluteFile path.string.expandFilename
|
||||
|
||||
proc setFromProjectName*(conf: ConfigRef; projectName: string) =
|
||||
try:
|
||||
conf.projectFull = canonicalizePath(conf, AbsoluteFile projectName)
|
||||
except OSError:
|
||||
conf.projectFull = AbsoluteFile projectName
|
||||
let p = splitFile(conf.projectFull)
|
||||
let dir = if p.dir.isEmpty: AbsoluteDir getCurrentDir() else: p.dir
|
||||
conf.projectPath = AbsoluteDir canonicalizePath(conf, AbsoluteFile dir)
|
||||
conf.projectName = p.name
|
||||
|
||||
proc removeTrailingDirSep*(path: string): string =
|
||||
if (path.len > 0) and (path[^1] == DirSep):
|
||||
result = substr(path, 0, path.len - 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue