|
of_parsepath
|
|
Full name
|
pfc_n_cst_filesrv.of_parsepath
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_parsepath(string,ref string,ref string,ref string,ref string)
|
Name
|
Datatype
|
li_Pos
|
integer
|
lnv_string
|
n_cst_string
|
ls_File
|
string
|
public function integer of_parsepath (string as_path, ref string as_drive, ref string as_dirpath, ref string as_filename, ref string as_ext);//////////////////////////////////////////////////////////////////////////////
// Public Function: of_ParsePath
// Arguments: as_Path The path to disassemble.
// as_Drive The disk drive from the path, passed by reference.
// as_DirPath The directory path, passed by reference.
// as_FileName The name of the file, passed by reference.
// as_Ext The file extension, passed by reference. If null is
// passed in, the extension will not be parsed out of the file.
// Returns: integer
// 1 if it succeeds and -1 if an error occurs.
// Description: Parse a fully-qualified directory path into its component parts.
//////////////////////////////////////////////////////////////////////////////
// Rev. History: Version
// 5.0 Initial version
//////////////////////////////////////////////////////////////////////////////
// Copyright © 1996-1999 Sybase, Inc. and its subsidiaries. All rights reserved. Any distribution of the
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
integer li_Pos
string ls_File
n_cst_string lnv_string
If IsNull(as_path) or Len(Trim(as_path))=0 Then Return -1
// Get the drive
li_Pos = Pos(as_Path, ":")
If li_Pos = 0 Then
as_Drive = ""
Else
If Mid(as_Path, (li_Pos + 1), 1) = is_Separator Then
li_Pos ++
End if
as_Drive = Left(as_Path, li_Pos)
as_Path = Right(as_Path, (Len(as_Path) - li_Pos))
End if
// Get the file name and extension
li_Pos = lnv_string.of_LastPos(as_Path, is_Separator, 0)
ls_File = Right(as_Path, (Len(as_Path) - li_Pos))
as_Path = Left(as_Path, li_Pos)
If IsNull(as_Ext) Then
as_FileName = ls_File
as_Ext = ""
Else
// Get the extension
li_Pos = lnv_string.of_LastPos(ls_File, ".")
If li_Pos > 0 Then
as_FileName = Left(ls_File, (li_Pos - 1))
as_Ext = Right(ls_File, (Len(ls_File) - li_Pos))
Else
as_FileName = ls_File
as_Ext = ""
End if
End If
// Everything left is the directory path
as_DirPath = as_Path
Return 1
end function
Name
|
Owner
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
systemfunctions.mid |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.right |
systemfunctions
|
systemfunctions.trim |
systemfunctions
|
pfc_n_cst_string.of_lastpos |
pfc_n_cst_string
|
pfc_n_cst_string.of_lastpos |
pfc_n_cst_string
|