Bug 17165 - normalizePath() doesn't return canonical case for long file names
Summary: normalizePath() doesn't return canonical case for long file names
Status: UNCONFIRMED
Alias: None
Product: R
Classification: Unclassified
Component: Windows GUI / Window specific (show other bugs)
Version: R-devel (trunk)
Hardware: Other Windows 64-bit
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2016-10-13 13:58 UTC by Kirill Müller
Modified: 2016-10-13 14:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kirill Müller 2016-10-13 13:58:50 UTC
It seems that the normalizePath() function returns canonical paths only for 8.3 file names. This is on a Windows 8.1 system with NTFS:

writeLines(character(), "eight.tre")
writeLines(character(), "eight.four")
writeLines(character(), "thirteen.tre")
writeLines(character(), "thirteen.four")

basename(normalizePath("EIGHT.TRE"))
## [1] "eight.tre"
basename(normalizePath("EIGHT.FOUR"))
## [1] "EIGHT.FOUR"
basename(normalizePath("THIRTEEN.TRE"))
## [1] "thirteen.tre"
basename(normalizePath("THIRTEEN.FOUR"))
## [1] "THIRTEEN.FOUR"

According to the documentation, normalizePath() "will match paths case-insensitively and return the canonical case". It would be great if normalizePath() returned the case with which the file was created also for non-8.3 paths.

> sessionInfo()
R Under development (unstable) (2016-10-12 r71510)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.4.0
Comment 1 Kirill Müller 2016-10-13 14:00:49 UTC
Extended example:

writeLines(character(), "seventeen.tre")
writeLines(character(), "seventeen.four")

basename(normalizePath("SEVENTEEN.TRE"))
## [1] "SEVENTEEN.TRE"
basename(normalizePath("SEVENTEEN.FOUR"))
## [1] "SEVENTEEN.FOUR"