home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!spool.mu.edu!umn.edu!csus.edu!netcom.com!gabriel
- From: gabriel@netcom.com (Gabriel Beccar-Varela)
- Subject: Bug in TFileDialog (TP 2.0)
- Message-ID: <1992Dec14.005316.28890@netcom.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Date: Mon, 14 Dec 1992 00:53:16 GMT
- Lines: 47
-
- Maybe someone already reported this bug, but I'll report it
- anyway. The TFileDialog does not work properly with TP 2.0 (it
- worked OK with TP 1.0). This is what happens: assuming that the
- current directory is C:\UTILS and DATA is a subdirectory under it,
- you can have the following situation:
-
- 1. Initial list of files:
-
- ANYTHING.EXE
- ANYTHING.OVR
- DATA\
- ..\
-
- 2. You select DATA\ and you get the following list:
-
- BIG.DOC
- SMALL.DOC
- MEDIUM.DOC
- ..\
-
- 3. You select BIG.DOC and the box closes. If you grab the selected
- file name using GetFileName(Filename) you will see that the full
- name is C:\UTILS\BIG.DOC (rather than C:\UTILS\DATA\BIG.DOC).
-
- After snooping around for a while, I discovered that the function
- RelativePath has a logical error in it. The code for that function in
- TP 1.0 is
-
- begin
- S := LTrim(RTrim(S));
- if (S <> '') and ((S[1] = '\') or (S[2] = ':')) then
- RelativePath := False
- else RelativePath := True;
- end;
-
- whereas in TP 2.0 is
-
- begin
- S := LTrim(RTrim(S));
- RelativePath := not (S <> '') and ((S[1] = '\') or (S[2] = ':'));
- end;
-
- The TP 2.0 will always return FALSE because "not S <> '' " is the
- same as "S = '' " and an empty string cannot have '\' as its first
- character. What is missing is a set of parentesis enclosing the entire
- statement after the "not". I simply copied the TP 1.0 code and
- TFileDialog worked fine.
-