From tplate at acm.org  Sat Jun 27 01:50:26 2009
From: tplate at acm.org (Tony Plate)
Date: Fri, 26 Jun 2009 17:50:26 -0600
Subject: [Rd] should Sys.glob() cope with a UNC windows path beginning with
	backslashes?
Message-ID: <4A455EC2.5020905@acm.org>

I find that Sys.glob() doesn't like UNC paths where the initial slashes are backslashes.  The help page for Sys.glob() doesn't specificly mention UNC paths, but does say: "File paths in Windows are interpreted with separator \ or /."  Is the failure to treat a path beginning with a double-backslash as a UNC network drive path the intended behavior?

E.g., on a Windows system where \\foo is a network drive and \\foo\bar exists, I see:

> Sys.glob("//foo/bar")
[1] "//foo/bar"
> Sys.glob("//foo\\bar")
[1] "//foo\\bar"
> Sys.glob("\\\\foo/bar")
character(0)
> Sys.glob("\\\\foo\\bar")
> 
(the pattern of behavior seems to be that initial backslashes are not equivalent to forward slashes, but later backslashes are.)

This is not a big deal, but I noticed it because it results in Rcmd check giving a spurious warning when started from a cygwin shell with a working directory that is a network drive specified as a UNC path.  This happens because mandir in tools:::.writePkgIndices has the form \\foo/bar/R/packages/mypkg/man, which results in the false warning "there is a 'man' dir but no help pages in this package."  A simple workaround was to use a drive-letter mount for the network drive.

> sessionInfo()
R version 2.9.1 (2009-06-26) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

-- Tony Plate



[Rd] should Sys.glob() cope with a UNC windows path beginning with backslashes?
Tony Plate