paths.html 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  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. <li>
  160. <a class="reference reference-toplevel" href="#19" id="69">Exports</a>
  161. </li>
  162. </ul>
  163. </div>
  164. <div class="nine columns" id="content">
  165. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  166. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  167. <div id="tocRoot"></div>
  168. <p class="module-desc"><p>This module implements path handling.</p>
  169. <p><strong>See also:</strong></p>
  170. <ul class="simple"><li><a class="reference external" href="files.html">files module</a> for file access</li>
  171. </ul>
  172. </p>
  173. <div class="section" id="6">
  174. <h1><a class="toc-backref" href="#6">Imports</a></h1>
  175. <dl class="item">
  176. <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>
  177. </dl>
  178. </div>
  179. <div class="section" id="7">
  180. <h1><a class="toc-backref" href="#7">Types</a></h1>
  181. <dl class="item">
  182. <div id="Path">
  183. <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>
  184. <dd>
  185. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L26" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  186. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L26" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  187. </dd>
  188. </div>
  189. </dl>
  190. </div>
  191. <div class="section" id="12">
  192. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  193. <dl class="item">
  194. <div id="/-procs-all">
  195. <div id="/,Path,Path">
  196. <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>
  197. <dd>
  198. <p>Joins two directory names to one.</p>
  199. <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>
  200. <p>See also:</p>
  201. <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>
  202. <li><a class="reference external" href="uri.html#combine,Uri,Uri">uri.combine proc</a></li>
  203. <li><a class="reference external" href="uri.html#/,Uri,string">uri./ proc</a></li>
  204. </ul>
  205. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L57" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  206. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L57" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  207. </dd>
  208. </div>
  209. </div>
  210. <div id="/../-procs-all">
  211. <div id="/../,Path,Path">
  212. <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>
  213. <dd>
  214. <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>
  215. <p>See also:</p>
  216. <ul class="simple"><li><a class="reference internal nimdoc" title="proc `/`(head, tail: Path): Path" href="#/,Path,Path">/ proc</a></li>
  217. <li><a class="reference internal nimdoc" title="proc parentDir(path: Path): Path" href="#parentDir,Path">parentDir proc</a></li>
  218. </ul>
  219. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L172" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  220. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L172" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  221. </dd>
  222. </div>
  223. </div>
  224. <div id="==-procs-all">
  225. <div id="==,Path,Path">
  226. <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>
  227. <dd>
  228. <p>Compares two paths.</p>
  229. <p>On a case-sensitive filesystem this is done case-sensitively otherwise case-insensitively.</p>
  230. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  231. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  232. </dd>
  233. </div>
  234. </div>
  235. <div id="absolutePath-procs-all">
  236. <div id="absolutePath,Path">
  237. <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> {.
  238. <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>
  239. <dd>
  240. <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>
  241. <p>See also:</p>
  242. <ul class="simple"><li><a class="reference internal nimdoc" title="proc normalizePath(path: var Path)" href="#normalizePath,Path">normalizePath proc</a></li>
  243. </ul>
  244. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L269" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  245. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L269" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  246. </dd>
  247. </div>
  248. </div>
  249. <div id="add-procs-all">
  250. <div id="add,Path,Path">
  251. <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>
  252. <dd>
  253. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  254. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  255. </dd>
  256. </div>
  257. </div>
  258. <div id="addFileExt-procs-all">
  259. <div id="addFileExt,Path,string">
  260. <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>
  261. <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>
  262. <dd>
  263. <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>
  264. <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>
  265. <p>See also:</p>
  266. <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>
  267. <li><a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a></li>
  268. <li><a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart proc</a></li>
  269. <li><a class="reference internal nimdoc" title="proc changeFileExt(filename: Path; ext: string): Path" href="#changeFileExt,Path,string">changeFileExt proc</a></li>
  270. </ul>
  271. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L221" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  272. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L221" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  273. </dd>
  274. </div>
  275. </div>
  276. <div id="changeFileExt-procs-all">
  277. <div id="changeFileExt,Path,string">
  278. <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>
  279. <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>
  280. <dd>
  281. <p>Changes the file extension to <tt class="docutils literal"><span class="pre"><span class="Identifier">ext</span></span></tt>.</p>
  282. <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>
  283. <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>
  284. <p>See also:</p>
  285. <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>
  286. <li><a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a></li>
  287. <li><a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart proc</a></li>
  288. <li><a class="reference internal nimdoc" title="proc addFileExt(filename: Path; ext: string): Path" href="#addFileExt,Path,string">addFileExt proc</a></li>
  289. </ul>
  290. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L204" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  291. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L204" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  292. </dd>
  293. </div>
  294. </div>
  295. <div id="expandTilde-procs-all">
  296. <div id="expandTilde,Path">
  297. <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>
  298. <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>
  299. <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>
  300. <dd>
  301. <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>
  302. <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>
  303. <p><strong class="examples_text">Example:</strong></p>
  304. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">appdirs</span>
  305. <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>
  306. <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>
  307. <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>
  308. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L290" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  309. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L290" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  310. </dd>
  311. </div>
  312. </div>
  313. <div id="extractFilename-procs-all">
  314. <div id="extractFilename,Path">
  315. <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>
  316. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  317. <dd>
  318. <p>Extracts the filename of a given <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>.</p>
  319. <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>
  320. <p>See also:</p>
  321. <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>
  322. <li><a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart proc</a></li>
  323. <li><a class="reference internal nimdoc" title="proc changeFileExt(filename: Path; ext: string): Path" href="#changeFileExt,Path,string">changeFileExt proc</a></li>
  324. <li><a class="reference internal nimdoc" title="proc addFileExt(filename: Path; ext: string): Path" href="#addFileExt,Path,string">addFileExt proc</a></li>
  325. </ul>
  326. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L181" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  327. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L181" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  328. </dd>
  329. </div>
  330. </div>
  331. <div id="getCurrentDir-procs-all">
  332. <div id="getCurrentDir">
  333. <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>
  334. <dd>
  335. <p>Returns the <span id="current-working-directory_1">current working directory</span> i.e. where the built binary is run.</p>
  336. <p>So the path returned by this proc is determined at run time.</p>
  337. <p>See also:</p>
  338. <ul class="simple"><li><a class="reference external" href="appdirs.html#getHomeDir">getHomeDir proc</a></li>
  339. <li><a class="reference external" href="appdirs.html#getConfigDir">getConfigDir proc</a></li>
  340. <li><a class="reference external" href="appdirs.html#getTempDir">getTempDir proc</a></li>
  341. <li><a class="reference external" href="dirs.html#setCurrentDir">setCurrentDir proc</a></li>
  342. <li><a class="reference external" href="system.html#currentSourcePath.t">currentSourcePath template</a></li>
  343. <li><a class="reference external" href="macros.html#getProjectPath">getProjectPath proc</a></li>
  344. </ul>
  345. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L248" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  346. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L248" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  347. </dd>
  348. </div>
  349. </div>
  350. <div id="hash-procs-all">
  351. <div id="hash,Path">
  352. <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>
  353. <dd>
  354. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L28" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  355. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L28" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  356. </dd>
  357. </div>
  358. </div>
  359. <div id="isAbsolute-procs-all">
  360. <div id="isAbsolute,Path">
  361. <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>
  362. <dd>
  363. <p>Checks whether a given <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> is absolute.</p>
  364. <p>On Windows, network paths are considered absolute too.</p>
  365. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L100" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  366. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L100" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  367. </dd>
  368. </div>
  369. </div>
  370. <div id="isRelativeTo-procs-all">
  371. <div id="isRelativeTo,Path,Path">
  372. <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>
  373. <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>
  374. <dd>
  375. 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>.
  376. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L123" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  377. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L123" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  378. </dd>
  379. </div>
  380. </div>
  381. <div id="isRootDir-procs-all">
  382. <div id="isRootDir,Path">
  383. <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>
  384. <dd>
  385. Checks whether a given <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt> is a root directory.
  386. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L151" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  387. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L151" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  388. </dd>
  389. </div>
  390. </div>
  391. <div id="lastPathPart-procs-all">
  392. <div id="lastPathPart,Path">
  393. <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>
  394. <dd>
  395. <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>
  396. <p>See also:</p>
  397. <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>
  398. <li><a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a></li>
  399. <li><a class="reference internal nimdoc" title="proc changeFileExt(filename: Path; ext: string): Path" href="#changeFileExt,Path,string">changeFileExt proc</a></li>
  400. <li><a class="reference internal nimdoc" title="proc addFileExt(filename: Path; ext: string): Path" href="#addFileExt,Path,string">addFileExt proc</a></li>
  401. </ul>
  402. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L193" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  403. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L193" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  404. </dd>
  405. </div>
  406. </div>
  407. <div id="normalizeExe-procs-all">
  408. <div id="normalizeExe,Path">
  409. <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>
  410. <dd>
  411. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L263" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  412. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L263" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  413. </dd>
  414. </div>
  415. </div>
  416. <div id="normalizePath-procs-all">
  417. <div id="normalizePath,Path">
  418. <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>
  419. <dd>
  420. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L265" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  421. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L265" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  422. </dd>
  423. </div>
  424. </div>
  425. <div id="normalizePathEnd-procs-all">
  426. <div id="normalizePathEnd,Path">
  427. <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>
  428. <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>
  429. <dd>
  430. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L267" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  431. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L267" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  432. </dd>
  433. </div>
  434. </div>
  435. <div id="parentDir-procs-all">
  436. <div id="parentDir,Path">
  437. <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>
  438. <dd>
  439. <p>Returns the parent directory of <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>.</p>
  440. <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>
  441. <p>See also:</p>
  442. <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>
  443. <li><a class="reference internal nimdoc" title="proc splitPath(path: Path): tuple[head, tail: Path]" href="#splitPath,Path">splitPath proc</a></li>
  444. <li><a class="reference internal nimdoc" title="proc tailDir(path: Path): Path" href="#tailDir,Path">tailDir proc</a></li>
  445. <li><a class="reference internal nimdoc" title="iterator parentDirs(path: Path; fromRoot = false; inclusive = true): Path" href="#parentDirs.i,Path">parentDirs iterator</a></li>
  446. </ul>
  447. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L128" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  448. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L128" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  449. </dd>
  450. </div>
  451. </div>
  452. <div id="relativePath-procs-all">
  453. <div id="relativePath,Path,Path">
  454. <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>
  455. <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>
  456. <dd>
  457. <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>
  458. <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>
  459. <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>
  460. <p>See also:</p>
  461. <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>
  462. <li><a class="reference internal nimdoc" title="proc parentDir(path: Path): Path" href="#parentDir,Path">parentDir proc</a></li>
  463. <li><a class="reference internal nimdoc" title="proc tailDir(path: Path): Path" href="#tailDir,Path">tailDir proc</a></li>
  464. </ul>
  465. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L106" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  466. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L106" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  467. </dd>
  468. </div>
  469. </div>
  470. <div id="splitFile-procs-all">
  471. <div id="splitFile,Path">
  472. <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>
  473. <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>
  474. <dd>
  475. <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>
  476. <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>
  477. <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>
  478. <p>See also:</p>
  479. <ul class="simple"><li><a class="reference internal nimdoc" title="proc extractFilename(path: Path): Path" href="#extractFilename,Path">extractFilename proc</a></li>
  480. <li><a class="reference internal nimdoc" title="proc lastPathPart(path: Path): Path" href="#lastPathPart,Path">lastPathPart proc</a></li>
  481. <li><a class="reference internal nimdoc" title="proc changeFileExt(filename: Path; ext: string): Path" href="#changeFileExt,Path,string">changeFileExt proc</a></li>
  482. <li><a class="reference internal nimdoc" title="proc addFileExt(filename: Path; ext: string): Path" href="#addFileExt,Path,string">addFileExt proc</a></li>
  483. </ul>
  484. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L82" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  485. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L82" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  486. </dd>
  487. </div>
  488. </div>
  489. <div id="splitPath-procs-all">
  490. <div id="splitPath,Path">
  491. <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>
  492. <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>
  493. <dd>
  494. <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>
  495. <p>See also:</p>
  496. <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>
  497. <li><a class="reference internal nimdoc" title="proc `/`(head, tail: Path): Path" href="#/,Path,Path">/ proc</a></li>
  498. <li><a class="reference internal nimdoc" title="proc `/../`(head, tail: Path): Path" href="#/../,Path,Path">/../ proc</a></li>
  499. <li><a class="reference internal nimdoc" title="proc relativePath(path, base: Path; sep = DirSep): Path" href="#relativePath,Path,Path">relativePath proc</a></li>
  500. </ul>
  501. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L70" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  502. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L70" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  503. </dd>
  504. </div>
  505. </div>
  506. <div id="tailDir-procs-all">
  507. <div id="tailDir,Path">
  508. <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>
  509. <dd>
  510. <p>Returns the tail part of <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>.</p>
  511. <p>See also:</p>
  512. <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>
  513. <li><a class="reference internal nimdoc" title="proc splitPath(path: Path): tuple[head, tail: Path]" href="#splitPath,Path">splitPath proc</a></li>
  514. <li><a class="reference internal nimdoc" title="proc parentDir(path: Path): Path" href="#parentDir,Path">parentDir proc</a></li>
  515. </ul>
  516. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L142" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  517. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L142" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  518. </dd>
  519. </div>
  520. </div>
  521. <div id="unixToNativePath-procs-all">
  522. <div id="unixToNativePath,Path">
  523. <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>
  524. <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>
  525. <dd>
  526. <p>Converts an UNIX-like path to a native one.</p>
  527. <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>
  528. <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>
  529. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L236" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  530. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L236" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  531. </dd>
  532. </div>
  533. </div>
  534. </dl>
  535. </div>
  536. <div class="section" id="15">
  537. <h1><a class="toc-backref" href="#15">Iterators</a></h1>
  538. <dl class="item">
  539. <div id="parentDirs-iterators-all">
  540. <div id="parentDirs.i,Path">
  541. <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> {.
  542. <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>
  543. <dd>
  544. <p>Walks over all parent directories of a given <tt class="docutils literal"><span class="pre"><span class="Identifier">path</span></span></tt>.</p>
  545. <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>
  546. <p>Relative paths won't be expanded by this iterator. Instead, it will traverse only the directories appearing in the relative path.</p>
  547. <p>See also:</p>
  548. <ul class="simple"><li><a class="reference internal nimdoc" title="proc parentDir(path: Path): Path" href="#parentDir,Path">parentDir proc</a></li>
  549. </ul>
  550. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L155" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  551. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L155" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  552. </dd>
  553. </div>
  554. </div>
  555. </dl>
  556. </div>
  557. <div class="section" id="18">
  558. <h1><a class="toc-backref" href="#18">Templates</a></h1>
  559. <dl class="item">
  560. <div id="$-templates-all">
  561. <div id="$.t,Path">
  562. <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>
  563. <dd>
  564. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/paths.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  565. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/paths.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  566. </dd>
  567. </div>
  568. </div>
  569. </dl>
  570. </div>
  571. <div class="section" id="19">
  572. <h1><a class="toc-backref" href="#19">Exports</a></h1>
  573. <dl class="item">
  574. <a href="osseps.html#ExtSep"><span class="Identifier">ExtSep</span></a>, <a href="osseps.html#FileSystemCaseSensitive"><span class="Identifier">FileSystemCaseSensitive</span></a>, <a href="osseps.html#DynlibFormat"><span class="Identifier">DynlibFormat</span></a>, <a href="osseps.html#DirSep"><span class="Identifier">DirSep</span></a>, <a href="osseps.html#AltSep"><span class="Identifier">AltSep</span></a>, <a href="osseps.html#PathSep"><span class="Identifier">PathSep</span></a>, <a href="osseps.html#ScriptExt"><span class="Identifier">ScriptExt</span></a>, <a href="osseps.html#doslikeFileSystem"><span class="Identifier">doslikeFileSystem</span></a>, <a href="osseps.html#ExeExt"><span class="Identifier">ExeExt</span></a>, <a href="osseps.html#CurDir"><span class="Identifier">CurDir</span></a>, <a href="osseps.html#ParDir"><span class="Identifier">ParDir</span></a>, <a href="oscommon.html#ReadDirEffect"><span class="Identifier">ReadDirEffect</span></a>, <a href="oscommon.html#WriteDirEffect"><span class="Identifier">WriteDirEffect</span></a>
  575. </dl>
  576. </div>
  577. </div>
  578. </div>
  579. <div class="twelve-columns footer">
  580. <span class="nim-sprite"></span>
  581. <br>
  582. <small style="color: var(--hint);">Made with Nim. Generated: 2025-04-22 15:32:48 UTC</small>
  583. </div>
  584. </div>
  585. </div>
  586. <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
  587. </body>
  588. </html>