Skip to content
Snippets Groups Projects
Commit 1eef21cc authored by Jonathan Wakely's avatar Jonathan Wakely
Browse files

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.
parent 6c96b14a
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment