(PureBasic) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
IncludeFile "CkFileAccess.pb"
Procedure ChilkatExample()
fac.i = CkFileAccess::ckCreate()
If fac.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Note: Chilkat accepts either forward slash or backslash chars as directory separators..
Debug CkFileAccess::ckGetDirectoryName(fac,"/MyDir/MySubDir/myfile.ext")
Debug CkFileAccess::ckGetDirectoryName(fac,"/MyDir/MySubDir")
Debug CkFileAccess::ckGetDirectoryName(fac,"/MyDir/")
Debug CkFileAccess::ckGetDirectoryName(fac,"/MyDir")
Debug CkFileAccess::ckGetDirectoryName(fac,"/")
Debug CkFileAccess::ckGetExtension(fac,"C:/mydir.old/myfile.ext")
Debug CkFileAccess::ckGetExtension(fac,"C:/mydir.old/")
Debug CkFileAccess::ckGetFileName(fac,"C:/mydir/myfile.ext")
Debug CkFileAccess::ckGetFileName(fac,"C:/mydir/")
Debug CkFileAccess::ckGetFileNameWithoutExtension(fac,"C:/mydir/myfile.ext")
Debug CkFileAccess::ckGetFileNameWithoutExtension(fac,"C:/mydir/")
Debug "---"
CkFileAccess::ckDispose(fac)
ProcedureReturn
EndProcedure
|