Scarab  v2.4.8
Project 8 C++ Utility Library
path.cc
Go to the documentation of this file.
1 /*
2  * path.cc
3  *
4  * Created on: Jan 22, 2016
5  * Author: nsoblath
6  */
7 
8 #define SCARAB_API_EXPORTS
9 
10 #include "path.hh"
11 
12 //#include <iostream>
13 
14 using std::string;
15 using boost::filesystem::absolute;
16 
17 namespace scarab
18 {
19  path SCARAB_API expand_path( const string& a_path )
20  {
21  string t_exp_path( a_path );
22 #ifndef _WIN32
23  // POSIX-shell-like expansion
24  wordexp_t t_expansion_result;
25  wordexp( a_path.c_str(), &t_expansion_result, 0 );
26  if( t_expansion_result.we_wordc > 0 )
27  {
28  t_exp_path = string( t_expansion_result.we_wordv[0] );
29  //std::cout << "#### expanded path: " << t_exp_path << std::endl;
30  }
31  wordfree( &t_expansion_result );
32 #endif
33  // do canonical expansion; return the absolute path
34  return absolute( t_exp_path );
35  }
36 
37 }
fs::path path
Definition: path.hh:25
path expand_path(const string &a_path)
Definition: path.cc:19
#define SCARAB_API
Definition: scarab_api.hh:24