Nim/lib
havardjohn 68f92af17c
Fix cannot create Windows directory in root (#20311)
* Fix cannot create Windows directory in root

Fixes #20306, a regression bug with `createDir` caused by
`23e0160af2`.

The issue is that, if the path consists only of a drive and a single
directory (e.g. "Y:\nimcache2" in the original issue), then no
directories will be created. This works fine if there are multiple
directories (e.g. "Y:\nimcache2\test").

In the case of "Y:\nimcache2", `omitNext` in `createDir` is `false` on
the last condition in `createDir`. This means that the "nimcache2"
directory will not be created, and no exception will be raised.

Fixed by refactoring to use `parentDirs` iterator instead of iterating
over the string characters. Motivation is reduced code complexity.

Will not test the specific "C:\test" `createDir` case, since there is no
standard Windows drive with write permissions in the root. Creating a
custom drive-mapping to Windows Temp is a non-option. That could mess
up some users running the test.

Added `parentDirs` tests since they are lacking on for POSIX paths.

* Fix `createDir("")` causing error

The change to `createDir` caused `createDir("")` to raise an error,
where it previously didn't. Fixed so `createDir("")` does not fail, and
added test case.
2022-09-11 16:51:39 -04:00
..
arch/x86 Coroutine rework. 2017-02-20 17:24:19 +02:00
core give a deprecate warning when using newPar to construct tuple expressions (#20312) 2022-09-06 21:38:08 +02:00
deprecated/pure remove some deprecated pre-1.0 stdlib modules (#20202) 2022-08-23 20:18:40 +02:00
experimental gitutils: add diffStrings, diffFiles, and use it in testament to compare expected vs gotten (#17892) 2021-04-30 11:00:33 +02:00
genode Genode platform fixes (#17521) 2021-04-09 16:29:10 +02:00
genode_cpp [std/locks]close #7998(complete condition variables) (#17711) 2021-04-19 10:51:13 +02:00
impure Implement Markdown definition lists (+ migration) (#20333) 2022-09-11 13:52:43 -04:00
js jsffi add missing braces (#19948) 2022-06-30 23:18:11 +02:00
packages/docutils Implement Markdown definition lists (+ migration) (#20333) 2022-09-11 13:52:43 -04:00
posix Adds missing SEEK_ POSIX constants for FreeRTOS (#20241) 2022-08-19 15:40:17 -04:00
pure Fix cannot create Windows directory in root (#20311) 2022-09-11 16:51:39 -04:00
std Implement Markdown definition lists (+ migration) (#20333) 2022-09-11 13:52:43 -04:00
system Implement Pandoc Markdown concise link extension (#20304) 2022-09-04 14:52:21 -04:00
windows enable style:usages for stdlib tests [backport: 1.6] (#19715) 2022-04-13 11:53:02 +02:00
wrappers SSL: Allow the same range of versions for OSX (#20324) 2022-09-10 09:58:40 +02:00
cycle.h Removes executable bit for text files. 2013-03-16 23:53:07 +01:00
deps.txt added lib/deps.txt 2021-06-03 14:00:53 +02:00
nimbase.h Add error message to pointer size check assert in lib/nimbase.h (#19549) 2022-02-27 15:36:16 +01:00
nimhcr.nim make implicit cstring conversions explicit (#19488) 2022-08-19 15:40:53 -04:00
nimhcr.nim.cfg Initial version of the hot-code reloading support for native targets (#10729) 2019-02-26 15:48:55 +01:00
nimrtl.nim add missing docs (#18758) 2021-08-29 09:18:54 +02:00
nimrtl.nim.cfg Initial version of the hot-code reloading support for native targets (#10729) 2019-02-26 15:48:55 +01:00
stdlib.nimble attempt to make the build green again 2017-01-07 02:55:15 +01:00
system.nim Revert "clarify that char may not be unsigned" (#20320) 2022-09-08 15:52:30 +08:00
system_overview.rst move io out of system (#19442) 2022-02-02 17:10:11 +01:00