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

Feature: absolute and relative file path validator functions for Unix & Windows #278 #423

Merged
merged 1 commit into from
Mar 7, 2021
Merged

Feature: absolute and relative file path validator functions for Unix & Windows #278 #423

merged 1 commit into from
Mar 7, 2021

Conversation

ArshiAAkhavan
Copy link
Contributor

Description

since the IsFilePath() function just checked the absolute paths #278, I've added IsUnixFilePath() & IsWinFilePath() functions for checking both absolutes and relative file paths in Unix and Windows.
Example:
isUnixFilePath("relative_file_path") => true
isUnixFilePath("./relative_file_path") => true
isUnixFilePath("../relative_file_path") => true

isWinFilePath("relative_file_path") => true
isWinFilePath("..\relative_file_path") => true
isWinFilePath("..\\relative_file_path") => false

IsUnixFilePath() & IsWinFilePath() functions are using UnixARPath & WinARPath regex in patterns.go
there are TestIsWinFilePath() & TestIsWinFilePath() test functions in validator_test.go for to demonstrate more

@asaskevich
Copy link
Owner

Thank you!

@asaskevich asaskevich merged commit f21760c into asaskevich:master Mar 7, 2021
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.

2 participants