News for hackers. Stuff that matters.
Re:Dotfile Madness by delta_p_delta_x on Sunday October 23, 2022 @10:38PM (#33312443)
> on Windows

There are many ways to access the filesystem on Windows. CMD.exe and PowerShell respect `..` to go to the parent directory, as does MSVC C++17 with `std::filesystem`, and C#, with `System.IO.Path.Combine(String, String)`.

In PowerShell and C#, there's also the `System.IO.DirectoryInfo.Parent` property, and of course, the equivalent `std::filesystem::path::parent_path` in MSVC C++.

Re:Dotfile Madness by TeMPOraL on Monday October 24, 2022 @07:30AM (#33315338)
There's an important consideration 'ChrisSD mentions here[0], i.e. whether resolving ".." is done lexically or by querying the filesystem. You may get different answers in each case if e.g. you try to resolve /foo/bar/../baz, when /foo/bar is a symlink to a different directory.

At least in case of std::filesystem, everything in std::filesystem::path is purely lexical. So, to get actual parent of some path, you'll need to go through std::filesystem::directory_entry and std::filesystem::read_symlink().

--

[0] - https://news.ycombinator.com/item?id=33312712