Synopsis - Cross-Reference
File: /tests/Cxx-API/Misc/src/Path.cc1#include <Synopsis/Path.hh> 2#include <string> 3#include <iostream> 4 5using namespace Synopsis; 6 7void test1() 8{ 9 std::string cwd = Path::cwd(); 10 Path path(__FILE__); // this file... 11 std::string file = path.basename(); // ...without any directory components... 12 std::cout << file << std::endl; 13 Path abs = Path(file).abs(); // ...the absolute path... 14// std::cout << abs.str() << std::endl;// ...which isn't usable for testing... 15 path = abs; 16 path.strip(cwd + Path::SEPARATOR); // ...without removing the prefix 17 std::cout << path.str() << std::endl; 18} 19 20int main(int, char **) 21{ 22 try 23 { 24 test1(); 25 } 26 catch (const std::exception &e) 27 { 28 std::cout << "Error : " << e.what() << std::endl; 29 } 30}