In contexts where folders or files are expected, the USoft Blend framework processes path expressions. They are the expressions that Microsoft Windows supports for designating (sets of) folders and files on the file system in command line syntax, ie., in the context of a Command Line Prompt (cmd.exe).
Data type
|
Explanation
|
Examples
|
path
|
An expression that points to a file or folder on the file system, or to a set of files or folders.
|
c:\temp\MyFolder
temp\MyFolder\
\\fs\temp\MyExample.xml
..\MyExample.xml
temp\*.xml
c:/temp/MyFolder
|
Many path expressions are a sequence of steps separated by backslashes that traverse the file system to point at the target file(s) or folder(s):
c:\MyFolder\MySubFolder\MyFile.txt
In the Windows OS, the backslash ( \ ) is the most common separator symbol between steps. It is the separator symbol required in DOS command lines. The USoft Blend API accepts the forward slash ( / ) as an alternative. But because of the mix of paths and XPath expressions, best practice in USoft Blend scripting is to reserve the backward slash for path expressions and the forward slash for XPath expressions.
Steps are not allowed to contain spaces, but they may contain underscores ( _ ) and hyphens ( ‑ ).
If a path ends in a backslash, the path matches only a folder, not any file in that folder:
c:\temp\
If the rightmost step is intended as a file name, one or more asterisks ( * ) in this file name act as wildcards representing any number of characters. The following path pattern points to all the files with extension ".xml" in the "c:\temp" folder:
c:\temp\*.xml
Each path is either an absolute path or a relative path:
Data type
|
Explanation
|
Examples
|
absolute-path
|
A path that points at a file or folder, or set of files or folders, independently of the working context.
|
c:\temp\MyExample.xml
d:\temp\MySubDirectory
\\fs\temp\*.xml
\\fs.mycompany.com\temp$\MyExample.xml
|
relative-path
|
A path that points at a file or folder, or set of files or folders by taking the working folder as a starting point.
|
MyExample.xml
MySubDirectory\*.xml
..\MyExample.xml
.\MyExample.xml
|
An absolute path is a path that starts with a letter indicating a local drive:
c:\temp\MyExample.xml
d:\temp\MyExample.xml
|
or with a double backslash indicating a shared drive:
\\fs\temp$\MyExample.xml
\\fs.mycompany.com\temp$\MyExample.xml
|
A relative path is any other path. A relative path is interpreted relatively to the current directory or working directory, where the leftmost element is a child folder or file relative to the current directory:
At the beginning of a relative path, a double full stop ( .. ) represents the parent directory of the current directory or working directory. Using this syntax, it is possible to point to ancestors at higher levels:
..\temp\MyExample.xml
..\..\temp\MyExample.xml
|
At the beginning of a relative path, a single full stop ( . ) represents the current directory or working directory itself. In USoft Blend this is useful in calls like the following, which returns the full path to the current directory:
|
Each path is either a file path or a folder path:
Data type
|
Explanation
|
Examples
|
file-path
|
A path in which the rightmost step is interpreted as the name of a file, or as an expression pointing to a set of files.
|
c:\temp\MyExample.xml
|
folder-path
|
A path in which the rightmost step is interpreted as the name of a folder.
|
c:\temp\MySubDirectory
c:\temp\MySubDirectory\
|
In a file path, the rightmost step is interpreted as the name of a file, or as file pattern pointing at a set of files. In a folder path, the rightmost step is interpreted as the name of a folder.
You can enforce that the rightmost step must be interpreted as a folder rather than a file by adding a trailing backslash:
For a path expression not ending in a backslash, there is no formal way of knowing whether the rightmost step is intended to point at a directory or at a file. The following example is likely to point at all the files in the "c:\temp" folder that have the ".xml" file extension, but theoretically it is possible that it points at a set of directory names ending in ".xml". File names are allowed to not contain full stops. Folder names are allowed to contain full stops.
This example uses as asterisk as a wildcard, turning the rightmost step into a pattern. See next two sections.
|
A file name pattern is a file name that contains an asterisk ( * ) in one or more places. The asterisk acts as a wildcard for file names. The following file name pattern represents all files with extension ".xml" in the given context:
A file name pattern may occur as the rightmost step of a file path. The following file path represents all files with extension ".xml" in directory "c:\temp":
A file name pattern may also occur as an attribute value in selected contexts, for example, as the value of the filter attribute of pc:Directory:
<pc:Directory filepath="c:\temp" filter="*.xml">
|
|
A directory name pattern is a step in a path expression that contains an asterisk ( * ) in one or more places and does not, or not exclusively, point at files.
The asterisk acts as a wildcard for both directory names and file names found in the current directory. Each step acts as a filter for directories and files that further restricts the result:
Directory name pattern
|
Matches
|
*
|
The entire content of the current directory, including subdirectories (to any level deep).
|
*.xml
|
All the files in the current directory that have the ".xml" extension.
All the subdirectories of which the name ends in .xml, including all their file contents and all subdirectories and their contents (to any level deep).
|
asset*
|
All the subdirectories and files of which the name starts with asset, including (in the case of the subdirectories) all file contents and all subdirectories and their contents (to any level deep).
|
asset*\resource*
|
All the subdirectories A of which the name starts with asset and that have a subdirectory B or file B that starts with resource. For each subdirectory A, all the subdirectories B with all their content (to any level deep), and also, all the files B.
|
|
See also
Guide to expressions and data types
Literal expressions
Dates
string literals
Path expressions
XML expressions
XPath expressions
Node set expressions
Booleans
Strings
Numbers
Function calls
Variable references
Implicit XPath datatype conversion
Evaluated expressions vs. literals
SQL expressions
|