src/utils/file.cpp
/**
   * Get glob results using given pattern
   */
Get glob results using given pattern
Get glob results using given pattern
vector<string> glob(string pattern) {
    glob_t result{};
    vector<string> ret;
    if (pattern[0] == '~') {
      pattern.replace(0, 1, env_util::get("HOME"));
    }
    if (::glob(pattern.c_str(), 0, nullptr, &result) == 0) {
      for (size_t i = 0_z; i < result.gl_pathc; ++i) {
        ret.emplace_back(result.gl_pathv[i]);
      }
      globfree(&result);
    }
    return ret;
  }
vector < string > glob ( string pattern ) { glob_t result { } ; vector < string > ret ; if ( pattern [ 0 ] == ' ' ) { pattern . replace ( 0 , 1 , env_util :: get ( " " ) ) ; } if ( :: glob ( pattern . c_str ( ) , 0 , nullptr , & result ) == 0 ) { for ( size_t i = 0 _z ; i < result . gl_pathc ; ++ i ) { ret . emplace_back ( result . gl_pathv [ i ] ) ; } globfree ( & result ) ; } return ret ; }
Get glob results using given pattern
Get glob results using given pattern
// Manually expand tilde to fix builds using versions of libc // that doesn't provide the GLOB_TILDE flag (musl for example)