get_current_dir.cpp 418 B

123456789101112131415161718
  1. //
  2. // $Id$
  3. //
  4. #include<__vic/fs.h>
  5. #include<__vic/throw_errno.h>
  6. #include<limits.h> // for PATH_MAX
  7. #include<unistd.h>
  8. //----------------------------------------------------------------------------
  9. std::string __vic::get_current_dir()
  10. {
  11. char buf[PATH_MAX];
  12. if(!::getcwd(buf, sizeof buf)) throw_errno("getcwd");
  13. return buf;
  14. }
  15. //----------------------------------------------------------------------------