Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.42 KB | None | 0 0
  1. ## The platform-specific path separator
  2. const platfPathSep =
  3.   when defined(windows):
  4.     '\\'
  5.   else:
  6.     '/'
  7.  
  8. ## A platform-independent path
  9. type Path = string
  10.  
  11. proc join*(args: varargs[Path]): Path =
  12.   ## Join path components to create a final path
  13.  
  14.   let argsWithSeps = map(args, proc(arg: Path): Path = arg & platfPathSep)
  15.   result = join(argsWithSeps)
  16.  
  17.   # Remove trailing separator
  18.   result = result[0.. ^1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement