I noticed that when getVirtualFile is called for a file, subsequent
calls to getFile will return a FileEntry without the RealPathName
computed:
const FileEntry *VFE = Mgr->getVirtualFile("/foo/../bar", ...); const FileEntry *FE = Mgr->getFile("/foo/../bar"); FE->tryGetRealPathName() returns an empty string.
This is because getVirtualFile creates a FileEntry without computing the
RealPathName field and stores it in SeenFileEntries. getFile then
simply retrieves this object and returns it, when asked for the same
file.
I think it's reasonable to try to compute RealPathName in getVirtualFile
too.
There might be a similar issue with the File field. If you call
getVirtualFile, then call getFile with open=true, you may get a
FileEntry with the File field NULL, which is not what you requested. I
have not addressed this issue in this patch though.
It seems that at this point, we have failed to find FileName in vfs (with getStatValue above), so getRealPath would also fail?
In general, the virtual file here can be an actual *virtual* file that doesn't exist anywhere, and I think there are users who use this to map virtual file (possibly with relative paths) into file manager (while they should really use overlay vfs!).