path.expand fails on some windows platform

Manuel Muñoz Márquez <[email protected]> Wed, 08 Jul 2026 17:32:07 +0200
Newsgroups gmane.comp.lang.r.general
Message-ID <[email protected]>
Dear all.

When using R version 4.6.1 on certain Windows platforms where the username =
contains non-ASCII characters (such as "=C3=A1"), the command:
path.expand("~")
fails with the following error:
Error: file name conversion problem -- name too long?

This occurs when the Windows OS does not define the R_USER environment vari=
able. In these cases, a call to Sys.getenv("R_USER") returns an
empty string ("").

However, if an .Renviron file is created with a valid path, such as:
R_USER=3D"C:\Users\%Username%\Documents"
then path.expand() works properly no matter if which the %Username% is.

This error propagates to other functions that internally call path.expand()=
, such as file.exists().

This behavior has been confirmed on multiple computers by various users run=
ning Windows 10 and 11.

In my opinion, this is a bug, as a standard path expansion should not trigg=
er a conversion error under these circumstances. Or is this the
expected behavior in this scenario?

More info:

https://github.com/RCmdr-Project/rcmdr/issues/8

Thank in advance.

-- =

Manuel Mu=C3=B1oz M=C3=A1rquez <[email protected]>