ID : 3881
RealPath
Function
To convert a relative path into an absolute path.
Syntax
RealPath(file path)
Guaranteed Entry
- File path
- Specifies a file path by string type data.
Return Value
Returns an absolute path by string type data.
Description
Converts a relative path which uses ".." or "." to an absolute path. The root of the absolute path is Source File folder.
Two or more delimiter are converted to one delimiter if multiple delimiter exist in the file path.
Related Terms
Attention
- This does not check whether the designated file or folder exists.
- Even if a folder locating upper than the route is designated, the folder is converted to the absolute path from the root.
Example
Example 1: Normalization when Creating an Absolute Path from a Relative Path.
As a result of the execution, S0 is converted to "\aaa\pro1".
Sub Main
S0 = "\aaa\bbb\ccc\
'\Convert the absolute path that includes relative path to the description that consists of
absolute path only
S0 = RealPath(S0 & "\..\..\pro1")
End Sub
Example 2: Activate Pro2 on the Current Path
If the program below is "\aaa\bbb\pro1.pcs", the result of RealPath will be "\aaa\bbb\pro2".
Sub Main
RunByName RealPath(__PATH__ & ".\pro2")
End Sub
ID : 3881