Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int chdir(const char* path)
- {
- if (access(path) == -1) {
- errno = ENOENT;
- return 1;
- }
- if (!is_directory(path)) {
- errno = ENOTDIR;
- return 1;
- }
- char* normalized_path = io_get_absolute_path(path);
- int result = setenv("CWD", path, 1);
- free(normalized_path);
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement