aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-11-13 17:36:49 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-11-13 17:36:49 -0700
commitbf03ae7acc2e8478958e46b2e418fcf29aa99128 (patch)
treeba03bad3ffa9d79677a2c46860b54c6046bb25ec /src/codegen/c.zig
parent211feea914615f67797d6a072cf34935004060d1 (diff)
downloadzig-bf03ae7acc2e8478958e46b2e418fcf29aa99128.tar.gz
zig-bf03ae7acc2e8478958e46b2e418fcf29aa99128.zip
std.fs.path.dirname: return null when input path is root
This intentionally diverges from the unix dirname command, as well as Python and Node.js standard libraries, which all have this edge case return the input path, unmodified. This is a footgun, and nobody should have ever done it this way. Even the man page contradicts the behavior. It says: "strip last component from file name". Now consider, if you remove the last item from an array of length 1, then you have now an array of length 0. After you strip the last component, there should be no components remaining. Clearly, returning the input parameter unmodified in this case does not match the documented behavior. This is my justification for taking a stand on this API design. closes #6746 closes #6727 closes #6584 closes #6592 closes #6602
Diffstat (limited to 'src/codegen/c.zig')
0 files changed, 0 insertions, 0 deletions