Skip to content

feat: exists to return the type of a path #1026

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 9 commits into
base: master
Choose a base branch
from

Conversation

wassup05
Copy link
Contributor

@wassup05 wassup05 commented Aug 2, 2025

User facing stuff added are

  • integer function exists (path [, err]) to check if a file exists and return it's type.
  • integer parameters, type_unknown, type_regular_file, type_directory, type_symlink which are the return values of the exists function.

To accomplish this, on unix lstat is used and on windows GetFileAttributesA is used.

  1. If any errors, type_unknown is returned
  2. the code and the string describing the code are provided through FS_ERROR_CODE (using strerror on unix and FormatMessageA on windows).
  3. and to accomplish this platform based error handling c_getstrerr now takes a logical winapi argument to switch between these two functions (strerror and FormatMessageA).

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.

1 participant