检查两个文件路径是否解析为同一文件

seb*_*n-c 2 windows r filepath

假设我有三个文件路径:

setwd("C:/superlongdirname")
files <- c("C:/superlongdirname/myfile.txt", "C:\\SUPERL~1\\myfile.txt", "./myfile.txt")
Run Code Online (Sandbox Code Playgroud)

这些都指向同一个文件.如果多次引用同一个文件,我可以检查它们是否确实引用了R中的同一个文件?

NJB*_*rgo 5

使用完整版本的文件路径并进行比较:

normalizePath(files[1]) == normalizePath(files[2])
Run Code Online (Sandbox Code Playgroud)