Peter
December 11, 2011, 11:03am
#1
Hi everybody,
I just started hacking on a small command line tool and
when I try to get a file with the following code it always gives
me an empty address.
main.exe c:\test.c
The same code compiled and running on linux works just fine.
int main (int argc, char **argv)
{
int ret = 0;
clang::FileManager fm = new clang::FileManager(clang::FileSystemOptions());
const clang::FileEntry file = fm->getFile(llvm::StringRef(argv[1]));
return(ret);
}
Is it a bug? I hope anybody can help me?
Thanks in advance,
Peter
I think that you problem is due to Clang’s assumption that all paths are in UTF8 and that’s not true for Windows, try converting your argv[1] to UTF8 and see if it helps.
chapuni
December 11, 2011, 2:35pm
#3
Would you like to try not on the root directory?
See also; http://llvm.org/bugs/show_bug.cgi?id=10331
...Takumi
Peter
December 11, 2011, 3:03pm
#4
Would you like to try not on the root directory?
Yes, that worked … Oh man, I should have tried it in the first place…
See also; http://llvm.org/bugs/show_bug.cgi?id=10331
So is it a bug…? Is there a workaround…?
Thanks so much for your help…!!!
Peter
June 14, 2012, 2:56pm
#5
Hii,
I still can’t read files from a root directory on Windows.
I am getting the following error
error: error reading ‘C:\test.c’
I’ve tried with the current llvm trunk and with the 3.1 and 3.0 version.
None of them worked. Any other path works just fine!!
Does anyone now what the problem might by?
Thanks in advance!!!
Peter
Peter, I believe I have fixed the issue in r158596.
...Takumi
Peter
June 16, 2012, 1:51pm
#7
Peter, I believe I have fixed the issue in r158596.
yheaaaaaaaa… :) Takumi, I just updated my svn brunch and it works now. Thanks so
much for your work!!!
Best regards from Germany!!