• Home
  • Raw
  • Download

Lines Matching refs:path

65 path_parent( const char*  path, int  levels )  in path_parent()  argument
67 const char* end = path + strlen(path); in path_parent()
74 while (end > path && ispathsep(end[-1])) in path_parent()
78 while (base > path && !ispathsep(base[-1])) in path_parent()
81 if (base <= path) /* we can't go that far */ in path_parent()
97 result = malloc( end-path+1 ); in path_parent()
99 memcpy( result, path, end-path ); in path_parent()
100 result[end-path] = 0; in path_parent()
116 path_split( const char* path, char* *pdirname, char* *pbasename ) in path_split() argument
118 const char* end = path + strlen(path); in path_split()
129 if (end == path) { in path_split()
134 while (end > path && ispathsep(end[-1])) in path_split()
138 if (end == path) { in path_split()
144 while (last > path && !ispathsep(last[-1])) in path_split()
148 if (last == path) { in path_split()
152 *pbasename = substring_dup(path,end); in path_split()
157 if (last == path+1) { in path_split()
161 *pbasename = substring_dup(path+1,end); in path_split()
180 *pdirname = substring_dup(path,last-1); in path_split()
186 path_basename( const char* path ) in path_basename() argument
190 if (path_split(path, NULL, &basename) < 0) in path_basename()
197 path_dirname( const char* path ) in path_dirname() argument
201 if (path_split(path, &dirname, NULL) < 0) in path_dirname()
215 path_exists( const char* path ) in path_exists() argument
218 CHECKED(ret, access(path, F_OK)); in path_exists()
224 path_is_regular( const char* path ) in path_is_regular() argument
229 CHECKED(ret, stat(path, &st)); in path_is_regular()
239 path_is_dir( const char* path ) in path_is_dir() argument
244 CHECKED(ret, stat(path, &st)); in path_is_dir()
253 path_can_read( const char* path ) in path_can_read() argument
256 CHECKED(ret, access(path, R_OK)); in path_can_read()
261 path_can_write( const char* path ) in path_can_write() argument
264 CHECKED(ret, access(path, R_OK)); in path_can_write()
269 path_can_exec( const char* path ) in path_can_exec() argument
272 CHECKED(ret, access(path, X_OK)); in path_can_exec()
279 path_mkdir( const char* path, int mode ) in path_mkdir() argument
283 return _mkdir(path); in path_mkdir()
286 CHECKED(ret, mkdir(path, mode)); in path_mkdir()
292 path_mkdir_recursive( char* path, unsigned len, int mode ) in path_mkdir_recursive() argument
299 while (len > 0 && ispathsep(path[len-1])) in path_mkdir_recursive()
310 while (len2 > 0 && !ispathsep(path[len2-1])) in path_mkdir_recursive()
314 old_c = path[len2]; in path_mkdir_recursive()
315 path[len2] = 0; in path_mkdir_recursive()
317 if ( !path_exists(path) ) { in path_mkdir_recursive()
319 ret = path_mkdir_recursive( path, len2, mode ); in path_mkdir_recursive()
321 path[len2] = old_c; in path_mkdir_recursive()
328 old_c = path[len]; in path_mkdir_recursive()
329 path[len] = 0; in path_mkdir_recursive()
330 ret = path_mkdir( path, mode ); in path_mkdir_recursive()
331 path[len] = old_c; in path_mkdir_recursive()
339 path_mkdir_if_needed( const char* path, int mode ) in path_mkdir_if_needed() argument
343 if (!path_exists(path)) { in path_mkdir_if_needed()
344 ret = path_mkdir(path, mode); in path_mkdir_if_needed()
348 unsigned len = (unsigned)strlen(path); in path_mkdir_if_needed()
354 memcpy( temp, path, len ); in path_mkdir_if_needed()
366 path_get_size( const char* path, uint64_t *psize ) in path_get_size() argument
373 HANDLE file = CreateFile( /* lpFilename */ path, in path_get_size()
398 CHECKED(ret, stat(path, &st)); in path_get_size()
408 path_is_absolute( const char* path ) in path_is_absolute() argument
411 if (path == NULL) in path_is_absolute()
414 if (path[0] == '/' || path[0] == '\\') in path_is_absolute()
421 if (path[0] != 0 && path[1] == ':') in path_is_absolute()
426 return (path != NULL && path[0] == '/'); in path_is_absolute()
431 path_get_absolute( const char* path ) in path_get_absolute() argument
433 if (path_is_absolute(path)) { in path_get_absolute()
434 return ASTRDUP(path); in path_get_absolute()
440 int pathLen = strlen(path); in path_get_absolute()
446 return ASTRDUP(path); in path_get_absolute()
454 memcpy(result + currentLen, path, pathLen+1); in path_get_absolute()
460 int pathLen = strlen(path); in path_get_absolute()
468 return ASTRDUP(path); in path_get_absolute()
479 memcpy(result + currentLen, path, pathLen+1); in path_get_absolute()
497 path_empty_file( const char* path ) in path_empty_file() argument
500 int fd = _creat( path, S_IWRITE ); in path_empty_file()
504 int fd = creat(path, S_IRUSR | S_IWUSR); in path_empty_file()
566 path_delete_file( const char* path ) in path_delete_file() argument
569 int ret = _unlink( path ); in path_delete_file()
574 ret = _chmod( path, _S_IREAD | _S_IWRITE ); in path_delete_file()
576 ret = _unlink( path ); in path_delete_file()
580 return unlink(path); in path_delete_file()