paths.html 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <!-- This file is generated by Nim. -->
  4. <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>std/paths</title>
  9. <!-- Google fonts -->
  10. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  11. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  12. <!-- Favicon -->
  13. <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
  14. <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
  15. <!-- CSS -->
  16. <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
  17. <!-- JS -->
  18. <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
  19. </head>
  20. <body>
  21. <div class="document" id="documentId">
  22. <div class="container">
  23. <h1 class="title">std/paths</h1>
  24. <div class="row">
  25. <div class="three columns">
  26. <div class="theme-select-wrapper">
  27. <label for="theme-select">Theme:&nbsp;</label>
  28. <select id="theme-select" onchange="setTheme(this.value)">
  29. <option value="auto">🌗 Match OS</option>
  30. <option value="dark">🌑 Dark</option>
  31. <option value="light">🌕 Light</option>
  32. </select>
  33. </div>
  34. <div id="global-links">
  35. <ul class="simple-boot">
  36. <li><a href="manual.html">Manual</a></li>
  37. <li><a href="lib.html">Standard library</a></li>
  38. <li> <a id="indexLink" href="theindex.html">Index</a></li>
  39. <li><a href="compiler/theindex.html">Compiler docs</a></li>
  40. <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
  41. <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
  42. </ul>
  43. </div>
  44. <div id="searchInputDiv">
  45. Search: <input type="search" id="searchInput"
  46. oninput="search()" />
  47. </div>
  48. <ul class="simple simple-toc" id="toc-list">
  49. <li>
  50. <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
  51. </li>
  52. <li>
  53. <details open>
  54. <summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
  55. <ul class="simple simple-toc-section">
  56. <li><a class="reference" href="#Path" title="Path = distinct string">Path</a></li>
  57. </ul>
  58. </details>
  59. </li>
  60. <li>
  61. <details open>
  62. <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
  63. <ul class="simple simple-toc-section">
  64. <ul class="simple nested-toc-section">/
  65. <li><a class="reference" href="#%2F%2CPath%2CPath" title="`/`(head, tail: Path): Path">`/`(head, tail: Path): Path</a></li>
  66. </ul>
  67. <ul class="simple nested-toc-section">/../
  68. <li><a class="reference" href="#%2F..%2F%2CPath%2CPath" title="`/../`(head, tail: Path): Path">`/../`(head, tail: Path): Path</a></li>
  69. </ul>
  70. <ul class="simple nested-toc-section">==
  71. <li><a class="reference" href="#%3D%3D%2CPath%2CPath" title="`==`(x, y: Path): bool">`==`(x, y: Path): bool</a></li>
  72. </ul>
  73. <ul class="simple nested-toc-section">absolutePath
  74. <li><a class="reference" href="#absolutePath%2CPath" title="absolutePath(path: Path; root = getCurrentDir()): Path">absolutePath(path: Path; root = getCurrentDir()): Path</a></li>
  75. </ul>
  76. <ul class="simple nested-toc-section">add
  77. <li><a class="reference" href="#add%2CPath%2CPath" title="add(x: var Path; y: Path)">add(x: var Path; y: Path)</a></li>
  78. </ul>
  79. <ul class="simple nested-toc-section">addFileExt
  80. <li><a class="reference" href="#addFileExt%2CPath%2Cstring" title="addFileExt(filename: Path; ext: string): Path">addFileExt(filename: Path; ext: string): Path</a></li>
  81. </ul>
  82. <ul class="simple nested-toc-section">changeFileExt
  83. <li><a class="reference" href="#changeFileExt%2CPath%2Cstring" title="changeFileExt(filename: Path; ext: string): Path">changeFileExt(filename: Path; ext: string): Path</a></li>
  84. </ul>
  85. <ul class="simple nested-toc-section">expandTilde
  86. <li><a class="reference" href="#expandTilde%2CPath" title="expandTilde(path: Path): Path">expandTilde(path: Path): Path</a></li>
  87. </ul>
  88. <ul class="simple nested-toc-section">extractFilename
  89. <li><a class="reference" href="#extractFilename%2CPath" title="extractFilename(path: Path): Path">extractFilename(path: Path): Path</a></li>
  90. </ul>
  91. <ul class="simple nested-toc-section">getCurrentDir
  92. <li><a class="reference" href="#getCurrentDir" title="getCurrentDir(): Path">getCurrentDir(): Path</a></li>
  93. </ul>
  94. <ul class="simple nested-toc-section">hash
  95. <li><a class="reference" href="#hash%2CPath" title="hash(x: Path): Hash">hash(x: Path): Hash</a></li>
  96. </ul>
  97. <ul class="simple nested-toc-section">isAbsolute
  98. <li><a class="reference" href="#isAbsolute%2CPath" title="isAbsolute(path: Path): bool">isAbsolute(path: Path): bool</a></li>
  99. </ul>
  100. <ul class="simple nested-toc-section">isRelativeTo
  101. <li><a class="reference" href="#isRelativeTo%2CPath%2CPath" title="isRelativeTo(path: Path; base: Path): bool">isRelativeTo(path: Path; base: Path): bool</a></li>
  102. </ul>
  103. <ul class="simple nested-toc-section">isRootDir
  104. <li><a class="reference" href="#isRootDir%2CPath" title="isRootDir(path: Path): bool">isRootDir(path: Path): bool</a></li>
  105. </ul>
  106. <ul class="simple nested-toc-section">lastPathPart
  107. <li><a class="reference" href="#lastPathPart%2CPath" title="lastPathPart(path: Path): Path">lastPathPart(path: Path): Path</a></li>
  108. </ul>
  109. <ul class="simple nested-toc-section">normalizeExe
  110. <li><a class="reference" href="#normalizeExe%2CPath" title="normalizeExe(file: var Path)">normalizeExe(file: var Path)</a></li>
  111. </ul>
  112. <ul class="simple nested-toc-section">normalizePath
  113. <li><a class="reference" href="#normalizePath%2CPath" title="normalizePath(path: var Path)">normalizePath(path: var Path)</a></li>
  114. </ul>
  115. <ul class="simple nested-toc-section">normalizePathEnd
  116. <li><a class="reference" href="#normalizePathEnd%2CPath" title="normalizePathEnd(path: var Path; trailingSep = false)">normalizePathEnd(path: var Path; trailingSep = false)</a></li>
  117. </ul>
  118. <ul class="simple nested-toc-section">parentDir
  119. <li><a class="reference" href="#parentDir%2CPath" title="parentDir(path: Path): Path">parentDir(path: Path): Path</a></li>
  120. </ul>
  121. <ul class="simple nested-toc-section">relativePath
  122. <li><a class="reference" href="#relativePath%2CPath%2CPath" title="relativePath(path, base: Path; sep = DirSep): Path">relativePath(path, base: Path; sep = DirSep): Path</a></li>
  123. </ul>
  124. <ul class="simple nested-toc-section">splitFile
  125. <li><a class="reference" href="#splitFile%2CPath" title="splitFile(path: Path): tuple[dir, name: Path, ext: string]">splitFile(path: Path): tuple[dir, name: Path, ext: string]</a></li>
  126. </ul>
  127. <ul class="simple nested-toc-section">splitPath
  128. <li><a class="reference" href="#splitPath%2CPath" title="splitPath(path: Path): tuple[head, tail: Path]">splitPath(path: Path): tuple[head, tail: Path]</a></li>
  129. </ul>
  130. <ul class="simple nested-toc-section">tailDir
  131. <li><a class="reference" href="#tailDir%2CPath" title="tailDir(path: Path): Path">tailDir(path: Path): Path</a></li>
  132. </ul>
  133. <ul class="simple nested-toc-section">unixToNativePath
  134. <li><a class="reference" href="#unixToNativePath%2CPath" title="unixToNativePath(path: Path; drive = Path(&quot;&quot;)): Path">unixToNativePath(path: Path; drive = Path(&quot;&quot;)): Path</a></li>
  135. </ul>
  136. </ul>
  137. </details>
  138. </li>
  139. <li>
  140. <details open>
  141. <summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
  142. <ul class="simple simple-toc-section">
  143. <ul class="simple nested-toc-section">parentDirs
  144. <li><a class="reference" href="#parentDirs.i%2CPath" title="parentDirs(path: Path; fromRoot = false; inclusive = true): Path">parentDirs(path: Path; fromRoot = false; inclusive = true): Path</a></li>
  145. </ul>
  146. </ul>
  147. </details>
  148. </li>
  149. <li>
  150. <details open>
  151. <summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
  152. <ul class="simple simple-toc-section">
  153. <ul class="simple nested-toc-section">$
  154. <li><a class="reference" href="#%24.t%2CPath" title="`$`(x: Path): string">`$`(x: Path): string</a></li>
  155. </ul>
  156. </ul>
  157. </details>
  158. </li>
  159. </ul>
  160. </div>
  161. <div class="nine columns" id="content">
  162. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  163. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  164. <div id="tocRoot"></div>
  165. <p class="module-desc"><p>This module implements path handling.</p>
  166. <p><strong>See also:</strong></p>
  167. <ul class="simple"><li><a class="reference external" href="files.html">files module</a> for file access</li>
  168. </ul>
  169. </p>
  170. <div class="section" id="6">
  171. <h1><a class="toc-backref" href="#6">Imports</a></h1>
  172. <dl class="item">
  173. <a class="reference external" href="osseps.html">osseps</a>, <a class="reference external" href="envvars.html">envvars</a>, <a class="reference external" href="osappdirs.html">osappdirs</a>, <a class="reference external" href="pathnorm.html">pathnorm</a>, <a class="reference external" href="hashes.html">hashes</a>, <a class="reference external" href="sugar.html">sugar</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="ospaths2.html">ospaths2</a>
  174. </dl>
  175. </div>
  176. <div class="section" id="7">
  177. <h1><a class="toc-backref" href="#7">Types</a></h1>
  178. <dl class="item">
  179. <div id="Path">
  180. <dt><pre><a href="paths.html#Path"><span class="Identifier">Path</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  181. <dd>
  182. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L26" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  183. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L26" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  184. </dd>
  185. </div>
  186. </dl>
  187. </div>
  188. <div class="section" id="12">
  189. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  190. <dl class="item">
  191. <div id="/-procs-all">
  192. <div id="/,Path,Path">
  193. <dt><pre><span class="Keyword">func</span> <a href="#%2F%2CPath%2CPath"><span class="Identifier">`/`</span></a><span class="Other">(</span><span class="Identifier">head</span><span class="Other">,</span> <span class="Identifier">tail</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  194. <dd>
  195. <p>Joins two directory names to one.</p>
  196. <p>returns normalized path concatenation of <tt class="docutils literal"><span class="pre"><span class="Identifier">head</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">tail</span></span></tt>, preserving whether or not <tt class="docutils literal"><span class="pre"><span class="Identifier">tail</span></span></tt> has a trailing slash (or, if tail if empty, whether head has one).</p>
  197. <p>See also:</p>
  198. <ul class="simple"><li><a class="reference internal nimdoc" title="proc splitPath(path: Path): tuple[head, tail: Path]" href="#splitPath,Path">splitPath proc</a></li>
  199. <li><a class="reference external" href="uri.html#combine,Uri,Uri">uri.combine proc</a></li>
  200. <li><a class="reference external" href="uri.html#/,Uri,string">uri./ proc</a></li>
  201. </ul>
  202. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L57" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  203. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L57" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  204. </dd>
  205. </div>
  206. </div>
  207. <div id="/../-procs-all">
  208. <div id="/../,Path,Path">
  209. <dt><pre><span class="Keyword">func</span> <a href="#%2F..%2F%2CPath%2CPath"><span class="Identifier">`/../`</span></a><span class="Other">(</span><span class="Identifier">head</span><span class="Other">,</span> <span class="Identifier">tail</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  210. <dd>
  211. <p>The same as <tt class="docutils literal"><span class="pre">parentDir(head) / tail</span></tt>, unless there is no parent directory. Then <tt class="docutils literal"><span class="pre">head / tail</span></tt> is performed instead.</p>
  212. <p>See also:</p>
  213. <ul class="simple"><li><a class="reference internal nimdoc" title="proc `/`(head, tail: Path): Path" href="#/,Path,Path">/ proc</a></li>
  214. <li><a class="reference internal nimdoc" title="proc parentDir(path: Path): Path" href="#parentDir,Path">parentDir proc</a></li>
  215. </ul>
  216. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L172" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  217. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L172" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  218. </dd>
  219. </div>
  220. </div>
  221. <div id="==-procs-all">
  222. <div id="==,Path,Path">
  223. <dt><pre><span class="Keyword">func</span> <a href="#%3D%3D%2CPath%2CPath"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  224. <dd>
  225. <p>Compares two paths.</p>
  226. <p>On a case-sensitive filesystem this is done case-sensitively otherwise case-insensitively.</p>
  227. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  228. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  229. </dd>
  230. </div>
  231. </div>
  232. <div id="absolutePath-procs-all">
  233. <div id="absolutePath,Path">
  234. <dt><pre><span class="Keyword">proc</span> <a href="#absolutePath%2CPath"><span class="Identifier">absolutePath</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">root</span> <span class="Other">=</span> <span class="Identifier">getCurrentDir</span><span class="Other">(</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.
  235. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  236. <dd>
  237. <p>Returns the absolute path of <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>, rooted at <tt class="docutils literal"><span class="pre"><span class="Identifier">root</span></span></tt> (which must be absolute; default: current directory). If <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> is absolute, return it, ignoring <tt class="docutils literal"><span class="pre"><span class="Identifier">root</span></span></tt>.</p>
  238. <p>See also:</p>
  239. <ul class="simple"><li><a class="reference internal nimdoc" title="proc normalizePath(path: var Path)" href="#normalizePath,Path">normalizePath proc</a></li>
  240. </ul>
  241. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L269" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  242. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L269" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  243. </dd>
  244. </div>
  245. </div>
  246. <div id="add-procs-all">
  247. <div id="add,Path,Path">
  248. <dt><pre><span class="Keyword">func</span> <a href="#add%2CPath%2CPath"><span class="Identifier">add</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span> {.<span class="Identifier">borrow</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  249. <dd>
  250. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  251. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  252. </dd>
  253. </div>
  254. </div>
  255. <div id="addFileExt-procs-all">
  256. <div id="addFileExt,Path,string">
  257. <dt><pre><span class="Keyword">func</span> <a href="#addFileExt%2CPath%2Cstring"><span class="Identifier">addFileExt</span></a><span class="Other">(</span><span class="Identifier">filename</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">ext</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  258. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  259. <dd>
  260. <p>Adds the file extension <tt class="docutils literal"><span class="pre"><span class="Identifier">ext</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt>, unless <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> already has an extension.</p>
  261. <p><tt class="docutils literal"><span class="pre"><span class="Identifier">Ext</span></span></tt> should be given without the leading <tt class="docutils literal"><span class="pre"><span class="CharLit">'.'</span></span></tt>, because some filesystems may use a different character. (Although I know of none such beast.)</p>
  262. <p>See also:</p>
  263. <ul class="simple"><li><a class="reference internal nimdoc" title="proc splitFile(path: Path): tuple[dir, name: Path, ext: string]" href="#splitFile,Path">splitFile proc</a></li>
  264. <li><a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a></li>
  265. <li><a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart proc</a></li>
  266. <li><a class="reference internal nimdoc" title="proc changeFileExt(filename: Path; ext: string): Path" href="#changeFileExt,Path,string">changeFileExt proc</a></li>
  267. </ul>
  268. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L221" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  269. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L221" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  270. </dd>
  271. </div>
  272. </div>
  273. <div id="changeFileExt-procs-all">
  274. <div id="changeFileExt,Path,string">
  275. <dt><pre><span class="Keyword">func</span> <a href="#changeFileExt%2CPath%2Cstring"><span class="Identifier">changeFileExt</span></a><span class="Other">(</span><span class="Identifier">filename</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">ext</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  276. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  277. <dd>
  278. <p>Changes the file extension to <tt class="docutils literal"><span class="pre"><span class="Identifier">ext</span></span></tt>.</p>
  279. <p>If the <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> has no extension, <tt class="docutils literal"><span class="pre"><span class="Identifier">ext</span></span></tt> will be added. If <tt class="docutils literal"><span class="pre"><span class="Identifier">ext</span></span></tt> == &quot;&quot; then any extension is removed.</p>
  280. <p><tt class="docutils literal"><span class="pre"><span class="Identifier">Ext</span></span></tt> should be given without the leading <tt class="docutils literal"><span class="pre"><span class="CharLit">'.'</span></span></tt>, because some filesystems may use a different character. (Although I know of none such beast.)</p>
  281. <p>See also:</p>
  282. <ul class="simple"><li><a class="reference internal nimdoc" title="proc splitFile(path: Path): tuple[dir, name: Path, ext: string]" href="#splitFile,Path">splitFile proc</a></li>
  283. <li><a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a></li>
  284. <li><a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart proc</a></li>
  285. <li><a class="reference internal nimdoc" title="proc addFileExt(filename: Path; ext: string): Path" href="#addFileExt,Path,string">addFileExt proc</a></li>
  286. </ul>
  287. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L204" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  288. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L204" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  289. </dd>
  290. </div>
  291. </div>
  292. <div id="expandTilde-procs-all">
  293. <div id="expandTilde,Path">
  294. <dt><pre><span class="Keyword">proc</span> <a href="#expandTilde%2CPath"><span class="Identifier">expandTilde</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span>
  295. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="envvars.html#ReadEnvEffect"><span class="Identifier">ReadEnvEffect</span></a><span class="Other">,</span> <a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">]</span><span class="Other">,</span>
  296. <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  297. <dd>
  298. <p>Expands <tt class="docutils literal"><span class="pre">~</span></tt> or a path starting with <tt class="docutils literal"><span class="pre">~/</span></tt> to a full path, replacing <tt class="docutils literal"><span class="pre">~</span></tt> with <a class="reference external" href="appdirs.html#getHomeDir">getHomeDir()</a> (otherwise returns <tt class="docutils literal"><span class="pre">path</span></tt> unmodified).</p>
  299. <p>Windows: this is still supported despite the Windows platform not having this convention; also, both <tt class="docutils literal"><span class="pre">~/</span></tt> and <tt class="docutils literal"><span class="pre">~\</span></tt> are handled.</p>
  300. <p><strong class="examples_text">Example:</strong></p>
  301. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">appdirs</span>
  302. <span class="Identifier">assert</span> <span class="Identifier">expandTilde</span><span class="Punctuation">(</span><span class="Identifier">Path</span><span class="Punctuation">(</span><span class="StringLit">&quot;~&quot;</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="Identifier">Path</span><span class="Punctuation">(</span><span class="StringLit">&quot;appname.cfg&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">getHomeDir</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="Identifier">Path</span><span class="Punctuation">(</span><span class="StringLit">&quot;appname.cfg&quot;</span><span class="Punctuation">)</span>
  303. <span class="Identifier">assert</span> <span class="Identifier">expandTilde</span><span class="Punctuation">(</span><span class="Identifier">Path</span><span class="Punctuation">(</span><span class="StringLit">&quot;~/foo/bar&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">getHomeDir</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">/</span> <span class="Identifier">Path</span><span class="Punctuation">(</span><span class="StringLit">&quot;foo/bar&quot;</span><span class="Punctuation">)</span>
  304. <span class="Identifier">assert</span> <span class="Identifier">expandTilde</span><span class="Punctuation">(</span><span class="Identifier">Path</span><span class="Punctuation">(</span><span class="StringLit">&quot;/foo/bar&quot;</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">Path</span><span class="Punctuation">(</span><span class="StringLit">&quot;/foo/bar&quot;</span><span class="Punctuation">)</span></pre>
  305. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L290" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  306. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L290" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  307. </dd>
  308. </div>
  309. </div>
  310. <div id="extractFilename-procs-all">
  311. <div id="extractFilename,Path">
  312. <dt><pre><span class="Keyword">func</span> <a href="#extractFilename%2CPath"><span class="Identifier">extractFilename</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  313. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  314. <dd>
  315. <p>Extracts the filename of a given <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>.</p>
  316. <p>This is the same as <tt class="docutils literal"><span class="pre">name &amp; ext</span></tt> from <a class="reference internal nimdoc" title="proc splitFile(path: Path): tuple[dir, name: Path, ext: string]" href="#splitFile,Path">splitFile(path) proc</a>.</p>
  317. <p>See also:</p>
  318. <ul class="simple"><li><a class="reference internal nimdoc" title="proc splitFile(path: Path): tuple[dir, name: Path, ext: string]" href="#splitFile,Path">splitFile proc</a></li>
  319. <li><a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart proc</a></li>
  320. <li><a class="reference internal nimdoc" title="proc changeFileExt(filename: Path; ext: string): Path" href="#changeFileExt,Path,string">changeFileExt proc</a></li>
  321. <li><a class="reference internal nimdoc" title="proc addFileExt(filename: Path; ext: string): Path" href="#addFileExt,Path,string">addFileExt proc</a></li>
  322. </ul>
  323. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L181" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  324. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L181" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  325. </dd>
  326. </div>
  327. </div>
  328. <div id="getCurrentDir-procs-all">
  329. <div id="getCurrentDir">
  330. <dt><pre><span class="Keyword">proc</span> <a href="#getCurrentDir"><span class="Identifier">getCurrentDir</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  331. <dd>
  332. <p>Returns the <span id="current-working-directory_1">current working directory</span> i.e. where the built binary is run.</p>
  333. <p>So the path returned by this proc is determined at run time.</p>
  334. <p>See also:</p>
  335. <ul class="simple"><li><a class="reference external" href="appdirs.html#getHomeDir">getHomeDir proc</a></li>
  336. <li><a class="reference external" href="appdirs.html#getConfigDir">getConfigDir proc</a></li>
  337. <li><a class="reference external" href="appdirs.html#getTempDir">getTempDir proc</a></li>
  338. <li><a class="reference external" href="dirs.html#setCurrentDir">setCurrentDir proc</a></li>
  339. <li><a class="reference external" href="system.html#currentSourcePath.t">currentSourcePath template</a></li>
  340. <li><a class="reference external" href="macros.html#getProjectPath">getProjectPath proc</a></li>
  341. </ul>
  342. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L248" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  343. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L248" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  344. </dd>
  345. </div>
  346. </div>
  347. <div id="hash-procs-all">
  348. <div id="hash,Path">
  349. <dt><pre><span class="Keyword">func</span> <a href="#hash%2CPath"><span class="Identifier">hash</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="hashes.html#Hash"><span class="Identifier">Hash</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  350. <dd>
  351. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L28" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  352. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L28" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  353. </dd>
  354. </div>
  355. </div>
  356. <div id="isAbsolute-procs-all">
  357. <div id="isAbsolute,Path">
  358. <dt><pre><span class="Keyword">func</span> <a href="#isAbsolute%2CPath"><span class="Identifier">isAbsolute</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  359. <dd>
  360. <p>Checks whether a given <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> is absolute.</p>
  361. <p>On Windows, network paths are considered absolute too.</p>
  362. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L100" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  363. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L100" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  364. </dd>
  365. </div>
  366. </div>
  367. <div id="isRelativeTo-procs-all">
  368. <div id="isRelativeTo,Path,Path">
  369. <dt><pre><span class="Keyword">proc</span> <a href="#isRelativeTo%2CPath%2CPath"><span class="Identifier">isRelativeTo</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">base</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
  370. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  371. <dd>
  372. Returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> is relative to <tt class="docutils literal"><span class="pre"><span class="Identifier">base</span></span></tt>.
  373. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L123" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  374. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L123" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  375. </dd>
  376. </div>
  377. </div>
  378. <div id="isRootDir-procs-all">
  379. <div id="isRootDir,Path">
  380. <dt><pre><span class="Keyword">func</span> <a href="#isRootDir%2CPath"><span class="Identifier">isRootDir</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  381. <dd>
  382. Checks whether a given <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> is a root directory.
  383. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L151" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  384. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L151" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  385. </dd>
  386. </div>
  387. </div>
  388. <div id="lastPathPart-procs-all">
  389. <div id="lastPathPart,Path">
  390. <dt><pre><span class="Keyword">func</span> <a href="#lastPathPart%2CPath"><span class="Identifier">lastPathPart</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  391. <dd>
  392. <p>Like <a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a>, but ignores trailing dir separator; aka: <span id="basename_1">baseName</span> in some other languages.</p>
  393. <p>See also:</p>
  394. <ul class="simple"><li><a class="reference internal nimdoc" title="proc splitFile(path: Path): tuple[dir, name: Path, ext: string]" href="#splitFile,Path">splitFile proc</a></li>
  395. <li><a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a></li>
  396. <li><a class="reference internal nimdoc" title="proc changeFileExt(filename: Path; ext: string): Path" href="#changeFileExt,Path,string">changeFileExt proc</a></li>
  397. <li><a class="reference internal nimdoc" title="proc addFileExt(filename: Path; ext: string): Path" href="#addFileExt,Path,string">addFileExt proc</a></li>
  398. </ul>
  399. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L193" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  400. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L193" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  401. </dd>
  402. </div>
  403. </div>
  404. <div id="normalizeExe-procs-all">
  405. <div id="normalizeExe,Path">
  406. <dt><pre><span class="Keyword">proc</span> <a href="#normalizeExe%2CPath"><span class="Identifier">normalizeExe</span></a><span class="Other">(</span><span class="Identifier">file</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span> {.<span class="Identifier">borrow</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  407. <dd>
  408. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L263" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  409. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L263" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  410. </dd>
  411. </div>
  412. </div>
  413. <div id="normalizePath-procs-all">
  414. <div id="normalizePath,Path">
  415. <dt><pre><span class="Keyword">proc</span> <a href="#normalizePath%2CPath"><span class="Identifier">normalizePath</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span> {.<span class="Identifier">borrow</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  416. <dd>
  417. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L265" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  418. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L265" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  419. </dd>
  420. </div>
  421. </div>
  422. <div id="normalizePathEnd-procs-all">
  423. <div id="normalizePathEnd,Path">
  424. <dt><pre><span class="Keyword">proc</span> <a href="#normalizePathEnd%2CPath"><span class="Identifier">normalizePathEnd</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">trailingSep</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.<span class="Identifier">borrow</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  425. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  426. <dd>
  427. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L267" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  428. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L267" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  429. </dd>
  430. </div>
  431. </div>
  432. <div id="parentDir-procs-all">
  433. <div id="parentDir,Path">
  434. <dt><pre><span class="Keyword">func</span> <a href="#parentDir%2CPath"><span class="Identifier">parentDir</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  435. <dd>
  436. <p>Returns the parent directory of <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>.</p>
  437. <p>This is similar to <tt class="docutils literal"><span class="pre">splitPath(path).head</span></tt> when <tt class="docutils literal"><span class="pre">path</span></tt> doesn't end in a dir separator, but also takes care of path normalizations. The remainder can be obtained with <a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart(path) proc</a>.</p>
  438. <p>See also:</p>
  439. <ul class="simple"><li><a class="reference internal nimdoc" title="proc relativePath(path, base: Path; sep = DirSep): Path" href="#relativePath,Path,Path">relativePath proc</a></li>
  440. <li><a class="reference internal nimdoc" title="proc splitPath(path: Path): tuple[head, tail: Path]" href="#splitPath,Path">splitPath proc</a></li>
  441. <li><a class="reference internal nimdoc" title="proc tailDir(path: Path): Path" href="#tailDir,Path">tailDir proc</a></li>
  442. <li><a class="reference internal nimdoc" title="iterator parentDirs(path: Path; fromRoot = false; inclusive = true): Path" href="#parentDirs.i,Path">parentDirs iterator</a></li>
  443. </ul>
  444. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L128" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  445. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L128" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  446. </dd>
  447. </div>
  448. </div>
  449. <div id="relativePath-procs-all">
  450. <div id="relativePath,Path,Path">
  451. <dt><pre><span class="Keyword">proc</span> <a href="#relativePath%2CPath%2CPath"><span class="Identifier">relativePath</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">sep</span> <span class="Other">=</span> <span class="Identifier">DirSep</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span>
  452. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  453. <dd>
  454. <p>Converts <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> to a path relative to <tt class="docutils literal"><span class="pre"><span class="Identifier">base</span></span></tt>.</p>
  455. <p>The <tt class="docutils literal"><span class="pre"><span class="Identifier">sep</span></span></tt> (default: DirSep) is used for the path normalizations, this can be useful to ensure the relative path only contains <tt class="docutils literal"><span class="pre"><span class="CharLit">'/'</span></span></tt> so that it can be used for URL constructions.</p>
  456. <p>On Windows, if a root of <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> and a root of <tt class="docutils literal"><span class="pre"><span class="Identifier">base</span></span></tt> are different, returns <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> as is because it is impossible to make a relative path. That means an absolute path can be returned.</p>
  457. <p>See also:</p>
  458. <ul class="simple"><li><a class="reference internal nimdoc" title="proc splitPath(path: Path): tuple[head, tail: Path]" href="#splitPath,Path">splitPath proc</a></li>
  459. <li><a class="reference internal nimdoc" title="proc parentDir(path: Path): Path" href="#parentDir,Path">parentDir proc</a></li>
  460. <li><a class="reference internal nimdoc" title="proc tailDir(path: Path): Path" href="#tailDir,Path">tailDir proc</a></li>
  461. </ul>
  462. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L106" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  463. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L106" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  464. </dd>
  465. </div>
  466. </div>
  467. <div id="splitFile-procs-all">
  468. <div id="splitFile,Path">
  469. <dt><pre><span class="Keyword">func</span> <a href="#splitFile%2CPath"><span class="Identifier">splitFile</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">dir</span><span class="Other">,</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">,</span> <span class="Identifier">ext</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
  470. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  471. <dd>
  472. <p>Splits a filename into <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">dir</span><span class="Punctuation">,</span> <span class="Identifier">name</span><span class="Punctuation">,</span> <span class="Identifier">extension</span><span class="Punctuation">)</span></span></tt> tuple.</p>
  473. <p><tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> does not end in DirSep unless it's <tt class="docutils literal"><span class="pre"><span class="Operator">/</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">extension</span></span></tt> includes the leading dot.</p>
  474. <p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> has no extension, <tt class="docutils literal"><span class="pre"><span class="Identifier">ext</span></span></tt> is the empty string. If <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> has no directory component, <tt class="docutils literal"><span class="pre"><span class="Identifier">dir</span></span></tt> is the empty string. If <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> has no filename component, <tt class="docutils literal"><span class="pre"><span class="Identifier">name</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">ext</span></span></tt> are empty strings.</p>
  475. <p>See also:</p>
  476. <ul class="simple"><li><a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a></li>
  477. <li><a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart proc</a></li>
  478. <li><a class="reference internal nimdoc" title="proc changeFileExt(filename: Path; ext: string): Path" href="#changeFileExt,Path,string">changeFileExt proc</a></li>
  479. <li><a class="reference internal nimdoc" title="proc addFileExt(filename: Path; ext: string): Path" href="#addFileExt,Path,string">addFileExt proc</a></li>
  480. </ul>
  481. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L82" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  482. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L82" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  483. </dd>
  484. </div>
  485. </div>
  486. <div id="splitPath-procs-all">
  487. <div id="splitPath,Path">
  488. <dt><pre><span class="Keyword">func</span> <a href="#splitPath%2CPath"><span class="Identifier">splitPath</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">head</span><span class="Other">,</span> <span class="Identifier">tail</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  489. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  490. <dd>
  491. <p>Splits a directory into <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">head</span><span class="Punctuation">,</span> <span class="Identifier">tail</span><span class="Punctuation">)</span></span></tt> tuple, so that <tt class="docutils literal"><span class="pre">head / tail == path</span></tt> (except for edge cases like &quot;/usr&quot;).</p>
  492. <p>See also:</p>
  493. <ul class="simple"><li><a class="reference internal nimdoc" title="proc add(x: var Path; y: Path)" href="#add,Path,Path">add proc</a></li>
  494. <li><a class="reference internal nimdoc" title="proc `/`(head, tail: Path): Path" href="#/,Path,Path">/ proc</a></li>
  495. <li><a class="reference internal nimdoc" title="proc `/../`(head, tail: Path): Path" href="#/../,Path,Path">/../ proc</a></li>
  496. <li><a class="reference internal nimdoc" title="proc relativePath(path, base: Path; sep = DirSep): Path" href="#relativePath,Path,Path">relativePath proc</a></li>
  497. </ul>
  498. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L70" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  499. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L70" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  500. </dd>
  501. </div>
  502. </div>
  503. <div id="tailDir-procs-all">
  504. <div id="tailDir,Path">
  505. <dt><pre><span class="Keyword">func</span> <a href="#tailDir%2CPath"><span class="Identifier">tailDir</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  506. <dd>
  507. <p>Returns the tail part of <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>.</p>
  508. <p>See also:</p>
  509. <ul class="simple"><li><a class="reference internal nimdoc" title="proc relativePath(path, base: Path; sep = DirSep): Path" href="#relativePath,Path,Path">relativePath proc</a></li>
  510. <li><a class="reference internal nimdoc" title="proc splitPath(path: Path): tuple[head, tail: Path]" href="#splitPath,Path">splitPath proc</a></li>
  511. <li><a class="reference internal nimdoc" title="proc parentDir(path: Path): Path" href="#parentDir,Path">parentDir proc</a></li>
  512. </ul>
  513. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L142" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  514. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L142" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  515. </dd>
  516. </div>
  517. </div>
  518. <div id="unixToNativePath-procs-all">
  519. <div id="unixToNativePath,Path">
  520. <dt><pre><span class="Keyword">func</span> <a href="#unixToNativePath%2CPath"><span class="Identifier">unixToNativePath</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">drive</span> <span class="Other">=</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">(</span><span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  521. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  522. <dd>
  523. <p>Converts an UNIX-like path to a native one.</p>
  524. <p>On an UNIX system this does nothing. Else it converts <tt class="docutils literal"><span class="pre"><span class="CharLit">'/'</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="CharLit">'.'</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="CharLit">'..'</span></span></tt> to the appropriate things.</p>
  525. <p>On systems with a concept of &quot;drives&quot;, <tt class="docutils literal"><span class="pre"><span class="Identifier">drive</span></span></tt> is used to determine which drive label to use during absolute path conversion. <tt class="docutils literal"><span class="pre"><span class="Identifier">drive</span></span></tt> defaults to the drive of the current working directory, and is ignored on systems that do not have a concept of &quot;drives&quot;.</p>
  526. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L236" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  527. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L236" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  528. </dd>
  529. </div>
  530. </div>
  531. </dl>
  532. </div>
  533. <div class="section" id="15">
  534. <h1><a class="toc-backref" href="#15">Iterators</a></h1>
  535. <dl class="item">
  536. <div id="parentDirs-iterators-all">
  537. <div id="parentDirs.i,Path">
  538. <dt><pre><span class="Keyword">iterator</span> <a href="#parentDirs.i%2CPath"><span class="Identifier">parentDirs</span></a><span class="Other">(</span><span class="Identifier">path</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">;</span> <span class="Identifier">fromRoot</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">;</span> <span class="Identifier">inclusive</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a> {.
  539. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  540. <dd>
  541. <p>Walks over all parent directories of a given <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>.</p>
  542. <p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">fromRoot</span></span></tt> is true (default: false), the traversal will start from the file system root directory. If <tt class="docutils literal"><span class="pre"><span class="Identifier">inclusive</span></span></tt> is true (default), the original argument will be included in the traversal.</p>
  543. <p>Relative paths won't be expanded by this iterator. Instead, it will traverse only the directories appearing in the relative path.</p>
  544. <p>See also:</p>
  545. <ul class="simple"><li><a class="reference internal nimdoc" title="proc parentDir(path: Path): Path" href="#parentDir,Path">parentDir proc</a></li>
  546. </ul>
  547. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L155" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  548. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L155" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  549. </dd>
  550. </div>
  551. </div>
  552. </dl>
  553. </div>
  554. <div class="section" id="18">
  555. <h1><a class="toc-backref" href="#18">Templates</a></h1>
  556. <dl class="item">
  557. <div id="$-templates-all">
  558. <div id="$.t,Path">
  559. <dt><pre><span class="Keyword">template</span> <a href="#%24.t%2CPath"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="paths.html#Path"><span class="Identifier">Path</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  560. <dd>
  561. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  562. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  563. </dd>
  564. </div>
  565. </div>
  566. </dl>
  567. </div>
  568. </div>
  569. </div>
  570. <div class="twelve-columns footer">
  571. <span class="nim-sprite"></span>
  572. <br>
  573. <small style="color: var(--hint);">Made with Nim. Generated: 2025-01-09 12:00:28 UTC</small>
  574. </div>
  575. </div>
  576. </div>
  577. <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
  578. </body>
  579. </html>