path canonicalization and proper project relative paths
This commit is contained in:
parent
e13a610ad4
commit
e4e74034c2
9 changed files with 61 additions and 47 deletions
|
|
@ -138,12 +138,13 @@ proc getPrefixDir*(): string =
|
|||
## gets the application directory
|
||||
result = SplitPath(getAppDir()).head
|
||||
|
||||
proc canonicalizePath*(path: string): string =
|
||||
result = path.expandFilename
|
||||
when not FileSystemCaseSensitive: result = result.toLower
|
||||
|
||||
proc shortenDir*(dir: string): string =
|
||||
## returns the interesting part of a dir
|
||||
var prefix = getPrefixDir() & dirSep
|
||||
if startsWith(dir, prefix):
|
||||
return substr(dir, len(prefix))
|
||||
prefix = getCurrentDir() & dirSep
|
||||
if startsWith(dir, prefix):
|
||||
return substr(dir, len(prefix))
|
||||
prefix = gProjectPath & dirSep
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue