Exemplo n.º 1
0
void FilterFlags(uint32_t flags, uint32_t* out_flags, bool* out_describe) {
    // Filter out flags that are invalid when combined with REF_ONLY.
    if (IsPathOnly(flags)) {
        flags &= ZX_FS_FLAG_VNODE_REF_ONLY | ZX_FS_FLAG_DIRECTORY | ZX_FS_FLAG_DESCRIBE;
    }

    *out_describe = flags & ZX_FS_FLAG_DESCRIBE;
    *out_flags = flags & (~ZX_FS_FLAG_DESCRIBE);
}
Exemplo n.º 2
0
// HasFile():
//  Returns true if the path doesn't end in /, \ or :
char * DirStrings::HasFile( const char *path ) {
  if( (IsPathOnly( path ) ) )
    return (char *)false;

  const char *filepart;
  for( int end = strlen(path) - 1; end >= 0; end-- ) {  // Look for a slash or :
    if( (path[end] == '\\' ) ||
        (path[end] == '/'  ) ||
        (path[end] == ':'  ) ) {
      filepart = &( path[end+1] );
      break;
    }
  }

  if( end < 0 )                                         // Entire path is file part; return pointer to everything
    return (char *)path;  

  return (char *)filepart;
}