R Under development (unstable) (2023-09-11 r85126 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > check <- function (path, dirname, basename) + { + stopifnot( + identical(dirname2(path), dirname), + identical(basename2(path), basename) + ) + } > > > dirname2 <- this.path:::.windows.dirname2 > basename2 <- this.path:::.windows.basename2 > > > check("", "", "") > > > check("d:", "d:.", "") > check("//host/share", "//host/share", "") > > > check("d:/", "d:/", "") > check("//host/share/", "//host/share/", "") > check("/", "/", "") > > > check("d:/path", "d:/", "path") > check("//host/share/path", "//host/share/", "path") > check("/path", "/", "path") > > > check("d:file", "d:.", "file") > check("file", ".", "file") > check("d:path/to/file", "d:path/to", "file") > > > check("d:/path/to/file", "d:/path/to", "file") > check("//host/share/path/to/file", "//host/share/path/to", "file") > check("/path/to/file", "/path/to", "file") > check("/path/to/file/", "/path/to", "file") > > > check( + this.path::path.join("/", "p1", "p2", "p3", c("file1", "file2")), + rep("/p1/p2/p3", 2), + c("file1", "file2") + ) > check( + this.path::path.join("/", "p1", "p2", "p3", "filename"), + "/p1/p2/p3", + "filename" + ) > > > check( + c("/usr/lib", "/usr/", "usr", "/", ".", ".."), + c("/usr" , "/" , "." , "/", ".", "."), + c("lib" , "usr" , "usr", "" , ".", "..") + ) > > > dirname2 <- this.path:::.unix.dirname2 > basename2 <- this.path:::.unix.basename2 > > > check("", "", "") > > > check("//host/share", "//host/share", "") > > > check("//host/share/", "//host/share/", "") > check("/", "/", "") > > > check("//host/share/path", "//host/share/", "path") > check("/path", "/", "path") > > > check("file", ".", "file") > > > check("//host/share/path/to/file", "//host/share/path/to", "file") > check("/path/to/file", "/path/to", "file") > check("/path/to/file/", "/path/to", "file") > > > check( + this.path::path.join("/", "p1", "p2", "p3", c("file1", "file2")), + rep("/p1/p2/p3", 2), + c("file1", "file2") + ) > check( + this.path::path.join("/", "p1", "p2", "p3", "filename"), + "/p1/p2/p3", + "filename" + ) > > > check( + c("/usr/lib", "/usr/", "usr", "/", ".", ".."), + c("/usr" , "/" , "." , "/", ".", "."), + c("lib" , "usr" , "usr", "" , ".", "..") + ) > > proc.time() user system elapsed 0.12 0.06 0.17