From ripley at stats.ox.ac.uk  Wed Jun 21 19:20:20 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 21 Jun 2006 18:20:20 +0100 (BST)
Subject: [Rd] loading library from network share (PR#8982)
In-Reply-To: <20060621163705.C76C317537@slim.kubism.ku.dk>
References: <20060621163705.C76C317537@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.64.0606211816100.31192@gannet.stats.ox.ac.uk>

On Wed, 21 Jun 2006, roy_kuraisa at merck.com wrote:

> Thanks for the info.
>
> It's interesting that R can load the library using a network share naming
> convention but that the library path has the "\" replaced with "/".  I guess
> it's too much to ask for R not to muck with the file name provided (for a
> variety of reasons).  My package works fine except for knowing the correct
> library path.
>
> As for mapping a drive, that's not a good solution for us because it would
> require users to always create a specific map drive (which on their desktop
> may not be available; when we add packages to other network shares, requires
> additional maps; etc).  Overall, it's not a very flexible solution for us.

It can easily be done via the domain controller: my sysadmins do it.

> My work around which, at least in my unique case, is a bit more flexible
> (but a little more klunky) is to add code in .First.lib that substitutes
> "\\" for "//" (because I need to read a cfg file in the "data" folder of the
> package when it is loaded).

This should work now that I have changed dirname (to do precisely that), 
but as I have no suitable test examples I cannot be sure.

>
>
> cheers, roy
>
>
> -----Original Message-----
> From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> Sent: Wednesday, June 21, 2006 1:57 AM
> To: Kuraisa, Roy J (Rosetta)
> Cc: R-bugs at biostat.ku.dk
> Subject: Re: [Rd] loading library from network share (PR#8982)
>
>
> This is not supported: network shares are a Windows 'feature' and not part
> of R's conception of file paths.  The specific issue here is dirname(),
> but it is widespread.
>
> You can always map shares to network drives, and that is common practice
> everywhere I have been which has extensive Windows networks.
>
> We have changed the dirname case, but have no intention of supporting this
> sort of file path in general, as one of the design goals of the Windows
> port of R was to work as similarly to the Unix-alikes as possible (and to
> share as much code as possible).
>
> On Wed, 14 Jun 2006, roy_kuraisa at merck.com wrote:
>
>> Full_Name: roy kuraisa
>> Version: 2.2.1
>> OS: Windows XP SP2
>> Submission from: (NULL) (155.91.28.232)
>>
>>
>> When loading a library from network share drive (e.g., \\nnn\f1\f2\p1),
> when
>> First.lib is called, the libray name contains "/" instead of "\" resulting
> in an
>> invalid Windows filepath.
>>
>> Here's an example:
>>> From R,
>>> library(foo.lib="\\\\kodak\\research_genetics\\rlibs");
>> Within First.lib,
>> .First.lib <-function(lib, pkg)
>> {
>>    cat("lib name ",lib,"\n")
>> }
>> produces the output
>>   lib name //kodak/research_genetics/rlibs
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] loading library from network share (PR#8982)
Prof Brian Ripley