MCPcopy Create free account
hub / github.com/boostorg/filesystem / current_path

Function current_path

src/operations.cpp:1059–1097  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1057 }
1058
1059 BOOST_FILESYSTEM_DECL
1060 path current_path(error_code* ec)
1061 {
1062# ifdef BOOST_POSIX_API
1063 path cur;
1064 for (long path_max = 128;; path_max *=2)// loop 'til buffer large enough
1065 {
1066 boost::scoped_array<char>
1067 buf(new char[static_cast<std::size_t>(path_max)]);
1068 if (::getcwd(buf.get(), static_cast<std::size_t>(path_max))== 0)
1069 {
1070 if (error(errno != ERANGE
1071 // bug in some versions of the Metrowerks C lib on the Mac: wrong errno set
1072# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
1073 && errno != 0
1074# endif
1075 , ec, "boost::filesystem::current_path"))
1076 {
1077 break;
1078 }
1079 }
1080 else
1081 {
1082 cur = buf.get();
1083 if (ec != 0) ec->clear();
1084 break;
1085 }
1086 }
1087 return cur;
1088
1089# else
1090 DWORD sz;
1091 if ((sz = ::GetCurrentDirectoryW(0, NULL))== 0)sz = 1;
1092 boost::scoped_array<path::value_type> buf(new path::value_type[sz]);
1093 error(::GetCurrentDirectoryW(sz, buf.get())== 0, ec,
1094 "boost::filesystem::current_path");
1095 return path(buf.get());
1096# endif
1097 }
1098
1099
1100 BOOST_FILESYSTEM_DECL

Callers 12

initial_pathFunction · 0.70
system_completeFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50
bad_directory_sizeFunction · 0.50
directory_iterator_testsFunction · 0.50
current_directory_testsFunction · 0.50
absolute_testsFunction · 0.50
canonical_basic_testsFunction · 0.50
initial_testsFunction · 0.50
cpp_mainFunction · 0.50
cpp_mainFunction · 0.50

Calls 2

errorFunction · 0.85
pathFunction · 0.50

Tested by 8

bad_directory_sizeFunction · 0.40
directory_iterator_testsFunction · 0.40
current_directory_testsFunction · 0.40
absolute_testsFunction · 0.40
canonical_basic_testsFunction · 0.40
initial_testsFunction · 0.40
cpp_mainFunction · 0.40
cpp_mainFunction · 0.40