Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Expression functions which return file info
base_file_name: Returns the base name of the file without the directory or file suffix. file_exists: Returns true if a file exists file_name: Returns the file name from a full path file_path: Returns the directory/path from a full file path file_size: Returns a file size file_suffix: Returns a files suffix/extension is_directory: Returns true if a file path is a directory is_file: Returns true if a file path is a file
- Loading branch information
1 parent
7e5f906
commit 762b2a4
Showing
10 changed files
with
171 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
{ | |||
"name": "base_file_name", | |||
"type": "function", | |||
"description": "Returns the base name of the file without the directory or file suffix.", | |||
"arguments": [ {"arg":"path","description":"a file path"}], | |||
"examples": [ { "expression":"base_file_name('/home/qgis/data/country_boundaries.shp')", "returns":"'country_boundaries'"}] | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
{ | |||
"name": "file_exists", | |||
"type": "function", | |||
"description": "Returns true if a file path exists.", | |||
"arguments": [ {"arg":"path","description":"a file path"}], | |||
"examples": [ { "expression":"file_exists('/home/qgis/data/country_boundaries.shp')", "returns":"true"}] | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
{ | |||
"name": "file_name", | |||
"type": "function", | |||
"description": "Returns the name of a file (including the file extension), excluding the directory.", | |||
"arguments": [ {"arg":"path","description":"a file path"}], | |||
"examples": [ { "expression":"base_file_name('/home/qgis/data/country_boundaries.shp')", "returns":"'country_boundaries.shp'"}] | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
{ | |||
"name": "file_path", | |||
"type": "function", | |||
"description": "Returns the directory component of a file path. This does not include the file name.", | |||
"arguments": [ {"arg":"path","description":"a file path"}], | |||
"examples": [ { "expression":"base_file_name('/home/qgis/data/country_boundaries.shp')", "returns":"'/home/qgis/data'"}] | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
{ | |||
"name": "file_size", | |||
"type": "function", | |||
"description": "Returns the size (in bytes) of a file.", | |||
"arguments": [ {"arg":"path","description":"a file path"}], | |||
"examples": [ { "expression":"file_size('/home/qgis/data/country_boundaries.geojson')", "returns":"5674"}] | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
{ | |||
"name": "file_suffix", | |||
"type": "function", | |||
"description": "Returns the file suffix (extension) from a file path.", | |||
"arguments": [ {"arg":"path","description":"a file path"}], | |||
"examples": [ { "expression":"base_file_name('/home/qgis/data/country_boundaries.shp')", "returns":"'shp'"}] | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
{ | |||
"name": "is_directory", | |||
"type": "function", | |||
"description": "Returns true if a path corresponds to a directory.", | |||
"arguments": [ {"arg":"path","description":"a file path"}], | |||
"examples": [ { "expression":"is_directory('/home/qgis/data/country_boundaries.shp')", "returns":"false"}, | |||
{ "expression":"is_directory('/home/qgis/data/')", "returns":"true"}] | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
{ | |||
"name": "is_file", | |||
"type": "function", | |||
"description": "Returns true if a path corresponds to a file.", | |||
"arguments": [ {"arg":"path","description":"a file path"}], | |||
"examples": [ { "expression":"is_file('/home/qgis/data/country_boundaries.shp')", "returns":"true"}, | |||
{ "expression":"is_file('/home/qgis/data/')", "returns":"false"}] | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters