Nyall Dawson 2bd18332aa [expressions] Make file function (such as base_file_name) gracefully
handle map layer values

These are treated as the file path to the layer.

E.g.

    base_file_name(@some_variable_which_is_a_layer)

will return the base file name of the layer's source
2022-02-07 16:02:37 +10:00

16 lines
571 B
Plaintext

{
"name": "file_name",
"type": "function",
"groups": ["Files and Paths"],
"description": "Returns the name of a file (including the file extension), excluding the directory.",
"arguments": [{
"arg": "path",
"description": "a file path or a map layer value. If a map layer layer value is specified then the file source of the layer will be used."
}],
"examples": [{
"expression": "file_name('/home/qgis/data/country_boundaries.shp')",
"returns": "'country_boundaries.shp'"
}],
"tags": ["extension", "name", "directory", "file", "path"]
}