path canonicalization and proper project relative paths

This commit is contained in:
Zahary Karadjov 2011-12-09 04:40:59 +02:00
commit e4e74034c2
9 changed files with 61 additions and 47 deletions

View file

@ -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