On Sat, Sep 18, 2021 at 06:57:28PM -0700, David Aguilar wrote: > + /* Remove trailing slashes when $TMPDIR ends in '/'. */ > + while (tmpdir.len > 0 && tmpdir.buf[tmpdir.len - 1] == '/') { > + strbuf_setlen(&tmpdir, tmpdir.len - 1); > + } > + strbuf_addstr(&tmpdir, "/git-difftool.XXXXXX"); It sounds like this should remove any directory separator (so on Windows, it should also drop backslashes). You can use is_dir_sep() for that, but better still, you can then do: strbuf_trim_trailing_dir_sep(&tmpdir); -Peff