[Rd] system() and system2() do not use long filenames on Windows
Hong Ooi
hongooi at microsoft.com
Mon Apr 30 11:35:33 CEST 2018
Hi,
On Windows, it appears that system() and system2() both use the 8.3 filename to run the supplied command, even if the full name is used. Most of the time this doesn't matter, but for .NET programs, it stops the program from finding its app.config file (which has the same name as the app, with '.config' appended).
Here is a simple test program, compiled with: g++ -o longfilename.exe test.cpp
#include <iostream>
int main(int argc, char **argv)
{
std::cout << argv[0] << '\n';
return 0;
}
When I run this from a command prompt, it prints the full name:
C:\>\users\hongooi\longfilename.exe
\users\hongooi\longfilename.exe
But when I run it from R (3.4.3) via system() or system2(), it prints the 8.3 filename:
> system2("c:\\users\\hongooi\\longfilename.exe")
c:\users\hongooi\LONGFI~1.EXE
And here is a question on StackOverflow where this cropped up: https://stackoverflow.com/questions/50090450/config-file-is-ignored-when-net-executable-is-called-from-r
Would it be possible to modify system() and system2() to respect long filenames?
More information about the R-devel
mailing list