Skip to main content

Location AddSegment

rascal-0.40.17

Synopsis

Locations can be concatenated with strings to add segments to the path component

Syntax

Loc + Str

Types

//

LocStrLoc + Str
locstrloc

Description

Adds a segment to the path component of a location. This concatenation introduces a path separator (/) automatically.

Examples

rascal>|tmp:///myDir| + "myFile";
loc: |tmp:///myDir/myFile|

To get the original back, you can use the parent field:

rascal>(|tmp:///myDir| + "myFile").parent
loc: |tmp:///myDir|