Win32::パスの結合
Win32シェルAPIであるPathCombineの説明が怪しかったのでいろいろ入れて確認してみたよ
http://msdn.microsoft.com/en-us/library/windows/desktop/bb773571.aspx
The directory path should be in the form of A:,B:, ..., Z:. The file path should be in a correct form that represents the file part of the path. The file path must not be null, and if it ends with a backslash, the backslash will be maintained.
SHOULDとか言っておいてどうせネットワークパスに対応してるんでしょ?というわけで・・・
Dir | File | Result |
---|---|---|
C: | 0.txt | C:\0.txt |
C:\ | 1.txt | C:\1.txt |
C: | \2.txt | C:\2.txt |
C:\path\ | \3.txt | C:\3.txt |
\\network\C$\path\ | \4.txt | \\network\C$\4.txt |
\\network\path\ | \5.txt | \\network\path\5.txt |
\\network\path\ | C:\6.txt | C:\6.txt |
\\network\path\ | \\other\path\7.txt | \\other\path\7.txt |
\\network\path\ | ..\8.txt | \\network\8.txt |
\\network\path\ | ..\..\9.txt | \\9.txt |
\\network\path\ | ..\..\..\10.txt | \\10.txt |
c:\folder | ..\..\..\11.txt | c:\11.txt |
folder\subfolder\lastfolder\ | ..\12.txt | folder\subfolder\12.txt |
まぁ、普通に使っている分には大体うまくいく、ってこったな。