Simplify is_path_accessible_using_standard_io

This commit is contained in:
twinaphex 2020-08-24 23:41:10 +02:00
parent 42a3d433dc
commit 74a3e5be8a

View File

@ -1280,17 +1280,15 @@ void fill_pathname_home_dir(char *s, size_t len)
bool is_path_accessible_using_standard_io(const char *path)
{
bool result = true;
#ifdef __WINRT__
size_t path_sizeof = PATH_MAX_LENGTH * sizeof(char);
char *relative_path_abbrev = (char*)malloc(path_sizeof);
fill_pathname_abbreviate_special(relative_path_abbrev, path, path_sizeof);
result = (strlen(relative_path_abbrev) >= 2 )
&& (relative_path_abbrev[0] == ':' || relative_path_abbrev[0] == '~')
char relative_path_abbrev[PATH_MAX_LENGTH];
fill_pathname_abbreviate_special(relative_path_abbrev,
path, sizeof(relative_path_abbrev));
return (strlen(relative_path_abbrev) >= 2 )
&& ( relative_path_abbrev[0] == ':'
|| relative_path_abbrev[0] == '~')
&& PATH_CHAR_IS_SLASH(relative_path_abbrev[1]);
free(relative_path_abbrev);
#else
return true;
#endif
return result;
}