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

add absolute and relative file path validator for Unix & Windows #278 #422

Closed
wants to merge 1 commit into from
Closed

add absolute and relative file path validator for Unix & Windows #278 #422

wants to merge 1 commit into from

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

@ArshiAAkhavan ArshiAAkhavan deleted the fixIsPath_I278 branch January 31, 2021 12:54
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