From 3c8c6bab540bdf4bae133c7c4264beaf6cb80a9f Mon Sep 17 00:00:00 2001 From: Matchman Green Date: Mon, 14 May 2012 00:26:16 +0800 Subject: [PATCH] Revert "adding xattr". seems it's better not to use xattr This reverts commit daf5bec3a1ec4c18b3326376ab6260bd1019b0cb. --- CMakeLists.txt | 2 +- cmake/Modules/FindAttr.cmake | 11 ----------- grive/src/main.cc | 14 ++++++++++---- libgrive/CMakeLists.txt | 2 -- libgrive/src/util/OS.cc | 22 +--------------------- libgrive/src/util/OS.hh | 5 ----- 6 files changed, 12 insertions(+), 44 deletions(-) delete mode 100644 cmake/Modules/FindAttr.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 218bb77..9bcea94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8) -set( GRIVE_VERSION "0.1.0-pre" ) +set( GRIVE_VERSION "0.0.5" ) add_subdirectory( libgrive ) add_subdirectory( grive ) diff --git a/cmake/Modules/FindAttr.cmake b/cmake/Modules/FindAttr.cmake deleted file mode 100644 index 9538e02..0000000 --- a/cmake/Modules/FindAttr.cmake +++ /dev/null @@ -1,11 +0,0 @@ -find_library( ATTR_LIBRARY NAMES attr PATH /usr/lib /usr/lib64 ) - -if ( ATTR_LIBRARY ) - set( ATTR_FOUND TRUE ) -endif (ATTR_LIBRARY) - -if ( ATTR_FOUND ) - - message( STATUS "Found libattr: ${ATTR_LIBRARY}") - -endif ( ATTR_FOUND ) diff --git a/grive/src/main.cc b/grive/src/main.cc index 34f5f60..ea10aaa 100644 --- a/grive/src/main.cc +++ b/grive/src/main.cc @@ -37,14 +37,20 @@ #include #include +#include -// registered keys from google const std::string client_id = "22314510474.apps.googleusercontent.com" ; const std::string client_secret = "bl4ufi89h-9MkFlypcI7R785" ; namespace gr { - struct ConfigError : virtual Exception {} ; + class ConfigError : public std::runtime_error + { + public : + ConfigError( const std::string& msg ) : runtime_error( msg ) + { + } + } ; const std::string& ConfigFilename() { @@ -69,9 +75,9 @@ namespace gr return Json::Parse( cfg_str ) ; } - catch ( Exception& e ) + catch ( std::runtime_error& e ) { - throw ConfigError() << expt::ErrMsg( std::string("Cannot open config file ") + e.what() ) ; + throw ConfigError( std::string("Cannot open config file ") + e.what() ) ; } } diff --git a/libgrive/CMakeLists.txt b/libgrive/CMakeLists.txt index 8159430..c76e4bb 100644 --- a/libgrive/CMakeLists.txt +++ b/libgrive/CMakeLists.txt @@ -9,7 +9,6 @@ find_package(EXPAT REQUIRED) find_package(CppUnit) find_package(Boost REQUIRED) find_package(BFD) -find_package(Attr REQUIRED) IF ( CPPUNIT_FOUND ) set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} ) @@ -66,7 +65,6 @@ target_link_libraries( grive ${CURL_LIBRARIES} ${JSONC_LIBRARY} ${OPENSSL_LIBRARIES} - ${ATTR_LIBRARY} ${OPT_LIBS} expat ) diff --git a/libgrive/src/util/OS.cc b/libgrive/src/util/OS.cc index ea6ac27..2e1cc99 100644 --- a/libgrive/src/util/OS.cc +++ b/libgrive/src/util/OS.cc @@ -34,7 +34,6 @@ // OS specific headers #include -#include #include #include #include @@ -85,26 +84,7 @@ void SetFileTime( const std::string& filename, const DateTime& t ) { struct timeval tvp[2] = { t.Tv(), t.Tv() } ; if ( ::utimes( filename.c_str(), tvp ) != 0 ) - throw Exception() << expt::ErrMsg( "cannot set file time" ) ; -} - -void SetXAttr( - const Path& filename, - const std::string& attr, - const std::string& value ) -{ - if ( ::setxattr( - filename.Str().c_str(), - attr.c_str(), - value.c_str(), - value.size(), - 0 ) != 0 ) - { - int err_num = errno ; - throw Exception() - << expt::ErrMsg( "cannot set file extended attribute of " + filename.Str() ) - << expt::ErrorNumber( err_num ) ; - } + throw expt::ErrMsg( "cannot set file time" ) ; } } } // end of namespaces diff --git a/libgrive/src/util/OS.hh b/libgrive/src/util/OS.hh index 0bed000..73dac5e 100644 --- a/libgrive/src/util/OS.hh +++ b/libgrive/src/util/OS.hh @@ -40,11 +40,6 @@ namespace os void SetFileTime( const std::string& filename, const DateTime& t ) ; void SetFileTime( const Path& filename, const DateTime& t ) ; - - void SetXAttr( - const Path& filename, - const std::string& attr, - const std::string& value ) ; } } // end of namespaces