Provides a host of services for working with Windows file paths.

Syntax

Result = SRP_Path(Service, Param1, Param2, Param3)

Returns

The meaning of the return value depends on the service.

Parameters

ParameterDescription
ServiceThe action to apply to the given path(s). Required.
Param1 - Param3Service parameters. See specific service for details.

Remarks

The SRP_Path was born out of the tedium involved with file path string manipulation. Since developers work with paths often, this service routine should make life a lot simpler for everyone. See the list services below to get details on what you can do with SRP_Path.

Service

Much like the Utility function in OpenInsight, the SRP_Path function provides multiple services which are identified in the Service parameter. The services are:

ServiceDescription
AddBackslashAdds a backslash to the end of a path if there isn't one.
AddExtensionAdds an extension to the end of the path.
CombineCombines two paths ensuring exactly one backslash between them.
ExistsDetermines if the path points to an existing file or directory
ExpandExpands a relative path into an absolute path.
FitToEditlineReformats the path to fit entirely within an EDITLINE control.
GetComponentsExtract one or more components from a path.
GetDirectoryExtracts the entire path except the last component.
GetExtensionExtracts the file extension, if there is one.
GetFilenameExtracts the filename with extension, if there is one.
GetParametersReturns an @FM delimited list of command line parameters.
GetPathReturns the full file path without command line parameters.
GetTempFilenameReturns a filename guaranteed to exist and be unique.
GetTempPathReturns the current user's temporary directory.
IsDirectoryDetermines if the path points to a valid directory.
IsDirectoryEmptyDetermines if the path points to a valid directory with no files.
IsNetworkPathDetermines if the path points to a remote network directory.
IsRelativeDetermines if the path is a relative path.
IsRootDetermines if the path points to a root drive or network store.
IsSameRootDetermines if both paths share the same root.
IsSystemFolderDetermines if the path points to a system folder.
IsUNCDetermines if the string is a UNC path.
IsURLDetermines if the string is a URL.
MakeRelativeMakes a path relative to another path.
PathToUncConverts a Windows path into a UNC path.
PathToUrlConverts a Windows path into a file URL.
QuoteAdds quotes to a path if it needs it.
RemoveBackslashRemoves a trailing backslash if there is one.
RemoveDirectoryRemoves everything except the last component of a path.
RemoveExtensionRemoves the file extension, if there is one.
RemoveFilenameRemoves the filename and extension, if there is one.
RemoveParametersRemoves the command line parameters.
RenameExtensionReplaces the file extension, or adds it if there isn't one already.
UrlToPathConverts a file URL into a Windows path.

Click on the service names above to read more details. Continue below for an explanation of the other parameters.

  • No labels