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
| Parameter | Description |
|---|---|
| Service | The action to apply to the given path(s). Required. |
| Param1 - Param3 | Service 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:
| Service | Description |
|---|---|
| AddBackslash | Adds a backslash to the end of a path if there isn't one. |
| AddExtension | Adds an extension to the end of the path. |
| Combine | Combines two paths ensuring exactly one backslash between them. |
| Exists | Determines if the path points to an existing file or directory |
| Expand | Expands a relative path into an absolute path. |
| FitToEditline | Reformats the path to fit entirely within an EDITLINE control. |
| GetComponents | Extract one or more components from a path. |
| GetDirectory | Extracts the entire path except the last component. |
| GetExtension | Extracts the file extension, if there is one. |
| GetFilename | Extracts the filename with extension, if there is one. |
| GetParameters | Returns an @FM delimited list of command line parameters. |
| GetPath | Returns the full file path without command line parameters. |
| GetTempFilename | Returns a filename guaranteed to exist and be unique. |
| GetTempPath | Returns the current user's temporary directory. |
| IsDirectory | Determines if the path points to a valid directory. |
| IsDirectoryEmpty | Determines if the path points to a valid directory with no files. |
| IsNetworkPath | Determines if the path points to a remote network directory. |
| IsRelative | Determines if the path is a relative path. |
| IsRoot | Determines if the path points to a root drive or network store. |
| IsSameRoot | Determines if both paths share the same root. |
| IsSystemFolder | Determines if the path points to a system folder. |
| IsUNC | Determines if the string is a UNC path. |
| IsURL | Determines if the string is a URL. |
| MakeRelative | Makes a path relative to another path. |
| PathToUnc | Converts a Windows path into a UNC path. |
| PathToUrl | Converts a Windows path into a file URL. |
| Quote | Adds quotes to a path if it needs it. |
| RemoveBackslash | Removes a trailing backslash if there is one. |
| RemoveDirectory | Removes everything except the last component of a path. |
| RemoveExtension | Removes the file extension, if there is one. |
| RemoveFilename | Removes the filename and extension, if there is one. |
| RemoveParameters | Removes the command line parameters. |
| RenameExtension | Replaces the file extension, or adds it if there isn't one already. |
| UrlToPath | Converts 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.