Thanks.  I did search the help, and I tried both extractFilePath &
extractFilename but they dont remove the '..' from the path.  expandFilename
works perfectly.

-----Original Message-----
From: Chris Crowe [mailto:[EMAIL PROTECTED]]
Sent: Monday, 2 August 1999 22:36
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Getting the actual filename


ExpandFilename()

Comes to mind..

ExpandFileName returns the full path of Filename.

Unit

SysUtils

Category

file name utilities

function ExpandFileName(const FileName: string): string;

Description

The ExpandFileName function converts the relative file name into a fully
qualified path name by merging in the current drive and directory. A fully
qualified path name includes the drive letter and any directory and
subdirectories in addition to the file name and extension. ExpandFileName
does not verify that the resulting fully qualified path name refers to an
existing file, or even that the resulting path exists.

Chris

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Wilfred Verkley
Sent: Monday, August 02, 1999 5: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

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

Reply via email to