Opened 13 years ago
Closed 13 years ago
#3185 closed Bugs (invalid)
absolute path error
Reported by: | Owned by: | Beman Dawes | |
---|---|---|---|
Milestone: | Boost 1.40.0 | Component: | filesystem |
Version: | Boost 1.37.0 | Severity: | Problem |
Keywords: | filesystem absolute path | Cc: |
Description
I have the following function that checks if a particular path is absolute or relative:
bool isPathAbsolute(const std::string& path) {
return !boost::filesystem::path(path).root_directory().empty();
}
Seems that it works fine for the following paths:
"/" absolute "/root" absolute "/" absolute "" absolute
However, for unknown reason function says that the path "" is not absolute. See attached very simple code that presents this problem.
Attachments (1)
Change History (2)
by , 13 years ago
Attachment: | boost_absolute_path_test.tar.gz added |
---|
comment:1 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
This isn't a bug - it is done deliberately to conform to POSIX. Here is the POSIX definition of Absolute Pathname:
3.2 Absolute Pathname
A pathname beginning with a single or more than two slashes; see also Pathname.
IIRC, Windows also treats two slashes differently, although it has been a while since I looked at how Windows handles multiple slashes.
HTH,
--Beman
the code printing the path's relativity checking result