Skip to content

Commit

Permalink
docs: Document string path building with examples
Browse files Browse the repository at this point in the history
Also document that line continuation didn't work before 0.50.

90c9b86 fixed it.
  • Loading branch information
nirbheek committed Jun 24, 2020
1 parent d42cd73 commit 83df219
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions docs/markdown/Syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ statements* and *includes*.
Usually one Meson statement takes just one line. There is no way to
have multiple statements on one line as in e.g. *C*. Function and
method calls' argument lists can be split over multiple lines. Meson
will autodetect this case and do the right thing. In other cases you
can get multi-line statements by ending the line with a `\`. Apart
from line ending whitespace has no syntactic meaning.
will autodetect this case and do the right thing.

In other cases, *(added 0.50)* you can get multi-line statements by ending the
line with a `\`. Apart from line ending whitespace has no syntactic meaning.

Variables
--
Expand Down Expand Up @@ -136,6 +137,24 @@ str2 = 'xyz'
combined = str1 + '_' + str2 # combined is now abc_xyz
```

#### String path building

*(Added 0.49)*

You can concatenate any two strings using `/` as an operator to build paths.
This will always use `/` as the path separator on all platforms.

```meson
joined = '/usr/share' / 'projectname' # => /usr/share/projectname
joined = '/usr/local' / '/etc/name' # => /etc/name
joined = 'C:\\foo\\bar' / 'builddir' # => C:/foo/bar/builddir
joined = 'C:\\foo\\bar' / 'D:\\builddir' # => D:/builddir
```

Note that this is equivalent to using [`join_paths()`](Reference-manual.md#join_paths),
which was obsoleted by this operator.

#### Strings running over multiple lines

Strings running over multiple lines can be declared with three single
Expand Down

0 comments on commit 83df219

Please sign in to comment.