* The string representing the corresponding file system path of this Uri.
*
* Will handle UNC paths and normalize windows drive letters to lower-case. Also
* uses the platform specific path separator.
*
* * Will *not* validate the path for invalid characters and semantics.
* * Will *not* look at the scheme of this Uri.
* * The resulting string shall *not* be used for display purposes but
* for disk operations, like `readFile` et al.
*
* The *difference* to the {@linkcode Uri.path path}-property is the use of the platform specific
* path separator and the handling of UNC paths. The sample below outlines the difference:
* ```ts
* const u = URI.parse('file://server/c$/folder/file.txt')
* u.authority === 'server'
* u.path === '/shares/c$/file.txt'
* u.fsPath === '\\server\c$\folder\file.txt'
* ```
VSCode の拡張機能で、開いているファイルに対応する GitHub 上での URL をコピーするというの *2 を作っている。不具合を issue *3 で教えてもらい、 Mac で直したら Windows で動かなくなっていて、 Windows でデバッグしたら path と fsPath の違いがあることに気づいた。
直したあと issue 上で動かなくなったよって教えてもらったときには Mac でしか試してなくて、再現しなくてなんでだろ……と思ったまま 2ヶ月経っていたのだけど、他の人にもそういえばその後どう?ってコメントしてもらって、 Windows で再現手順をもらったところで、そういえば Windows で動かないってことがあるのかも、と気づけた。ファイルシステムのパスを扱うときは OS の違いも意識したい……。
$ git help --all--no-external-commands--no-alias | grep'^ ' | awk '{ print $1 }' | cut -c1 | sort | uniq -c | sort-nr25 c
18 s
17r16 m
16 f
14 p
8 d
7 a
6 i
6 g
5 v
5 u
5 h
5 b
4 l
3 w
2 n
1 t
1 q
ちなみに正規表現を Regexper で図にするとこうなった。長い。頭文字 c だけ抜粋したものを貼りつつ全部の図も details の中に入れておきます。