CFile:GetPath


The GetPath method returns as a string the full path name of the file attached to the CFile.

Syntax

sPath = CFile:Path()

sPath = CFile:Path( nMaxChars )

bullet.gif    The first form returns the full path as a string.

bullet.gif    The second form returns an abbreviated path of, at most, nMaxChars characters.

bullet.gif    On failure, this method returns nil.

Example

Suppose a CFile object F is attached to a file opened from the path sPath, which is 'C:\My Folder\My File.txt'. Then

F = new_file()

-- Create a new CFile

F:Open( sPath, "r+t" )

-- open the file as text, for read and write

Printf( "%s\n", F:GetPath() )

-- prints 'C:\My Folder\My File.txt'

Printf( "%s\n", F:GetPath(20) )

-- prints 'C:\...\My File.txt'

Related Topics

CFile class, Open, CSplitpath


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.