Skip to content

feat(users/ignoring): add escaping on Windows #919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion users/faq-parts/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ files ``qax``, ``qbx`` and ``qcx``.
To match an actual file *called* ``q[abc]x`` the pattern needs to "escape"
the brackets, like so: ``q\[abc\]x``.

On Windows, escaping special characters is not supported as the ``\``
On Windows, use the ``|`` character to escape the brackets (``q|[abc|]x``), as the ``\``
character is used as a path separator.

How do I access the web GUI from another computer?
Expand Down
26 changes: 20 additions & 6 deletions users/ignoring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,26 @@ The ``.stignore`` file contains a list of file or path patterns. The

.. note::

Escaped characters are not supported on Windows, where ``\`` is the
path separator. If you still need to match files that have square or
curly brackets in their names, one possible workaround is to replace
them with ``?``, which will then match any character. For example,
you can type ``?banana?`` to match both ``[banana]`` and
``{banana}``, and so on.
On Windows, ``\`` is the path separator, so use ``|`` to escape special
characters. For example, ``|{banana|}`` matches
``{banana}``.

To use ``\`` to escape special characters (and use ``/`` as the path separator),
insert a ``#escape=\`` at the top of the file. Here's a short example:

| ``#escape=\``
| ``/foo``
| ``/path/bar/\{banana\}``
| ``/path/baz\[2\]/ex\[3\].txt``

``#escape=\`` must be placed at the top of the file, before any patterns,
but leading comments, and blank lines are OK.

Any files included using ``#include`` (see below) will each need their
own ``#escape=\``.

Using ``#escape=\`` allows the same file to be synced and used on any
operating system.

- A pattern beginning with ``/`` matches in the root of the synced folder only.
``/foo`` matches ``foo`` but not ``subdir/foo``.
Expand Down