Skip to content
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

ISSUE-240: Method to convert path to pattern #392

Merged
merged 2 commits into from
May 24, 2023
Merged

ISSUE-240: Method to convert path to pattern #392

merged 2 commits into from
May 24, 2023

Conversation

mrmlnc
Copy link
Owner

@mrmlnc mrmlnc commented May 9, 2023

What is the purpose of this pull request?

Fix #240.

The main purpose is to allow users to stop processing Windows paths in each location where this package is used, using third-party packages.

The story about automatic pattern conversion is out of the issue now, as it is a separate big layer of problems.

What changes did you make? (Give an overview)

  1. The .escapePath method now escapes a different set of special characters depending on the platform. Two methods have also been added: .escapePosixPath, .escapeWindowsPath.
    1.1. Added support for escaping an escape character (\\) when it is not followed by a special character.
    1.2. On Windows, the following characters *?|[] will no longer be escaped. Because it is not possible to use these characters in a path in DOS.
  2. Added the .convertPathToPattern method, which allows you to safely convert DOS paths and UNC paths into patterns. Two methods have also been added: .convertPosixPathToPattern, .convertWindowsPathToPattern.
    2.1. This allows Windows paths to be passed as patterns after they have been converted. For example, fg.convertPathToPattern('\\\\?\\c:\\Program Files (x86)') + '/**' or fg.convertPathToPattern('C://Program Files (x86)') + '/**'.
    2.2. Remove dependencies like normalize-path and slash, which we previously suggested in the documentation.

More details in the documentation: escapePath and convertPathToPattern.

@mrmlnc mrmlnc force-pushed the ISSUE-240_p2p branch 2 times, most recently from d73877a to 6b0624a Compare May 9, 2023 13:48
@mrmlnc mrmlnc added this to the 3.3.0 milestone May 13, 2023
@mrmlnc mrmlnc force-pushed the ISSUE-240_p2p branch 2 times, most recently from 1a98e6d to 688e6a0 Compare May 14, 2023 09:56
@mrmlnc mrmlnc marked this pull request as ready for review May 24, 2023 06:30
@mrmlnc mrmlnc merged commit 1d9d3ce into master May 24, 2023
@mrmlnc mrmlnc deleted the ISSUE-240_p2p branch May 24, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add method to convert paths to globs
1 participant