Strange behaviour with inquire function
Axel Freyn
axel-freyn@gmx.de
Wed Jan 27 14:21:00 GMT 2010
Hi,
>>> In fact, the "failure" occurs at runtime in the sense that the EXIST
>>> output argument is False when I expected it to be True
>>> for an existing directory. The version of gfortran I use is 4.5.0
>>> and I
>>> downloaded it from the gofrtran website. I use it on cmd
>>> environment. I think that I understood your explication Tobias, but
>>> why:
>>>
>>> inquire(file = '\\MYDIR', exist = exist) gives False
>>>
>>> while
>>>
>>> inquire(file='Y:\MYDIR', exist = exist), where Y is the drive letter
>>> mapped to the network directory, gives True ?
>>>
>> I don't recall the \\ for root in Windows being valid. I will have to
>> check that some time.
>
> I forgot what it is called but it is used such that you don't need to
> map in network drives. I know cmd.exe cannot handle those paths so we
> might be using an API that does not handle them either.
I'm not an expert for fortran, but e.g. in the Windows explorer
"\\MYDIR" refers to the COMPUTER with the name "MYDIR", while "Y:\MYDIR"
refers to the subdirectory "MYDIR" on the Network-share which is mapped
to the drive "Y:". So I don't see only one possible situation, where
"\\MYDIR" and "Y:\MYDIR" would refer to the same object:
A Computer "MYDIR" exports a directory (e.g. "test") accessible as
"\\MYDIR\", and, in addition, it also exports a second directory (e.g.
"parent"), which is in fact the parent-directory of "test". Now, if the
client-Computer mapped "Y:" onto "\\MYDIR\parent", "Y:\MYDIR" refers to
the directory "parent\MYDIR", which is the same as the directly exported
share \\MYDIR ....
However, even in this (strange) example, only the exporting computer
would know that the two object "\\MYDIR" and "Y:\MYDIR" are the same -
the client does not know that.
So I could imagine that Fortran is right and one of the two exists in
the given setup, while the other one doesn't. If you access both Path's
by Windows Explorer - do they really both exist?
Axel
More information about the Fortran
mailing list