utils: add expand_path (wordexp wrapper)

For expanding command-line options for shells that don't do that by themselves.
This commit is contained in:
Dirk-Jan C. Binnema
2023-08-02 20:43:45 +03:00
parent b91272aca2
commit 111e48efa3
2 changed files with 38 additions and 0 deletions

View File

@ -75,6 +75,16 @@ bool check_dir(const std::string& path, bool readable, bool writeable);
*/
std::string canonicalize_filename(const std::string& path, const std::string& relative_to);
/**
* Expand the filesystem path (as per wordexp(3))
*
* @param str a filesystem path string
*
* @return the expanded string or some error
*/
Result<std::string> expand_path(const std::string& str);
/*
* for OSs with out support for direntry->d_type, like Solaris
*/