Rev | Line | |
---|
[12] | 1 | // equivalent program -------------------------------------------------------// |
---|
| 2 | |
---|
| 3 | // Copyright © 2004 Beman Dawes |
---|
| 4 | |
---|
| 5 | // Use, modification, and distribution is subject to the Boost Software |
---|
| 6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy |
---|
| 7 | // at http://www.boost.org/LICENSE_1_0.txt) |
---|
| 8 | |
---|
| 9 | // See library home page at http://www.boost.org/libs/filesystem |
---|
| 10 | |
---|
| 11 | //----------------------------------------------------------------------------// |
---|
| 12 | |
---|
| 13 | #include <boost/filesystem/operations.hpp> |
---|
| 14 | #include <iostream> |
---|
| 15 | #include <exception> |
---|
| 16 | |
---|
| 17 | int main( int argc, char * argv[] ) |
---|
| 18 | { |
---|
| 19 | boost::filesystem::path::default_name_check( boost::filesystem::native ); |
---|
| 20 | if ( argc != 3 ) |
---|
| 21 | { |
---|
| 22 | std::cout << "Usage: equivalent path1 path2\n"; |
---|
| 23 | return 2; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | bool eq; |
---|
| 27 | try |
---|
| 28 | { |
---|
| 29 | eq = boost::filesystem::equivalent( argv[1], argv[2] ); |
---|
| 30 | } |
---|
| 31 | catch ( const std::exception & ex ) |
---|
| 32 | { |
---|
| 33 | std::cout << ex.what() << "\n"; |
---|
| 34 | return 3; |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | std::cout << (eq ? "Paths are equivalent\n" : "Paths are not equivalent\n"); |
---|
| 38 | return !eq; |
---|
| 39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.