> On Jun 6, 2019, at 3:59 AM, Ivan Krylov <krylov.r...@gmail.com> wrote:
> 
> On Wed, 5 Jun 2019 18:07:15 +0200
> Frank Schwidom <schwi...@gmx.net> wrote:
> 
>> +> path.expand("a ~ b")  
>> [1] "a /home/user b"
> 
>> How can I switch off any file crippling activity?
> 
> It doesn't seem to be possible if readline is enabled and works
> correctly.
> 
> Calls to path.expand [1] end up [2] in R_ExpandFileName [3], which
> calls R_ExpandFileName_readline [4], which uses libreadline function
> tilde_expand [5]. tilde_expand seems to be designed to expand '~'
> anywhere in the string it is handed, i.e. operate on whole command
> lines, not file paths.
> 

FWIW, the tilde does not always trigger this behavior. 

It seems that the tilde needs to be first in the string or preceded by 
whitespace and succeeded by whitespace or a path separator so the result looks 
like a path. 

> path.expand("~/abc/~/def")
[1] "/Users/cberry/abc/~/def"
> 

> path.expand("~/abc/ ~/def")
[1] "/Users/cberry/abc/ /Users/cberry/def"

> path.expand("~/abc/ ~tilde~/def")
[1] "/Users/cberry/abc/ ~tilde~/def"
> 
> path.expand("~/abc/ ~tilde ~/def")
[1] "/Users/cberry/abc/ ~tilde /Users/cberry/def"

An inelegant workaround could be built by adding escapes to the initial path 
and stripping them from the result.

Perhaps, the intent (in GNU deadline) was to allow a string with multiple paths 
separated by whitespace to be processed.

Maybe this is seen as a feature in GNU readline even though it is not helpful 
here.

HTH,

Chuck

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to