-
- Downloads
libstdc++: Improve exceptions thrown from fs::temp_directory_path
Currently the throwing overload of fs::temp_directory_path() will discard the path that was obtained from the environment. When it fails because the path doesn't resolve to a directory you get an unhelpful error like: filesystem error: temp_directory_path: Not a directory It would be better to also print the path in that case, e.g. filesystem error: temp_directory_path: Not a directory [/home/bob/tmp] libstdc++-v3/ChangeLog: * src/c++17/fs_ops.cc (fs::temp_directory_path()): Include path in exception. (fs::temp_directory_path(error_code&)): Rearrange to more closely match the structure of the first overload. * src/filesystem/ops.cc (fs::temp_directory_path): Likewise. * testsuite/27_io/filesystem/operations/temp_directory_path.cc: Check that exception contains the path. * testsuite/experimental/filesystem/operations/temp_directory_path.cc: Likewise.
Showing
- libstdc++-v3/src/c++17/fs_ops.cc 23 additions, 11 deletionslibstdc++-v3/src/c++17/fs_ops.cc
- libstdc++-v3/src/filesystem/ops.cc 19 additions, 12 deletionslibstdc++-v3/src/filesystem/ops.cc
- libstdc++-v3/testsuite/27_io/filesystem/operations/temp_directory_path.cc 5 additions, 0 deletions...tsuite/27_io/filesystem/operations/temp_directory_path.cc
- libstdc++-v3/testsuite/experimental/filesystem/operations/temp_directory_path.cc 5 additions, 0 deletions...experimental/filesystem/operations/temp_directory_path.cc
Loading
Please register or sign in to comment