You could use ExtractFileName and ExtractFilePath
Compare the Paths and check the Filename under your Path...

HTH

Regards
Paul
[EMAIL PROTECTED]
(Wellington - New Zealand)


-----Original Message-----
From: Wilfred Verkley [mailto:[EMAIL PROTECTED]]
Sent: Monday, 02 August 1999 05:12 PM
To: Multiple recipients of list delphi
Subject: [DUG]: Getting the actual filename


Heya,

I want to check whether a file name is "under" a certain directory.

i.e. is "c:\data\templates\file.txt" under the "c:\data\templates"
directory?

I would just use a simple string compare however the problem is the user can
type in a name like this as well:

"c:\data\templates\..\..\topsecret\file.txt"

Is there an existing function to resolve the actual filename or path?

Thank you,

Wilfred.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to