mirror of https://github.com/vitalif/grive2
Revert "adding xattr". seems it's better not to use xattr
This reverts commit daf5bec3a1ec4c18b3326376ab6260bd1019b0cb.pull/40/head
parent
31800ae2f1
commit
3c8c6bab54
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
set( GRIVE_VERSION "0.1.0-pre" )
|
set( GRIVE_VERSION "0.0.5" )
|
||||||
|
|
||||||
add_subdirectory( libgrive )
|
add_subdirectory( libgrive )
|
||||||
add_subdirectory( grive )
|
add_subdirectory( grive )
|
||||||
|
|
|
@ -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 )
|
|
|
@ -37,14 +37,20 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
// registered keys from google
|
|
||||||
const std::string client_id = "22314510474.apps.googleusercontent.com" ;
|
const std::string client_id = "22314510474.apps.googleusercontent.com" ;
|
||||||
const std::string client_secret = "bl4ufi89h-9MkFlypcI7R785" ;
|
const std::string client_secret = "bl4ufi89h-9MkFlypcI7R785" ;
|
||||||
|
|
||||||
namespace gr
|
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()
|
const std::string& ConfigFilename()
|
||||||
{
|
{
|
||||||
|
@ -69,9 +75,9 @@ namespace gr
|
||||||
|
|
||||||
return Json::Parse( cfg_str ) ;
|
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() ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ find_package(EXPAT REQUIRED)
|
||||||
find_package(CppUnit)
|
find_package(CppUnit)
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
find_package(BFD)
|
find_package(BFD)
|
||||||
find_package(Attr REQUIRED)
|
|
||||||
|
|
||||||
IF ( CPPUNIT_FOUND )
|
IF ( CPPUNIT_FOUND )
|
||||||
set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} )
|
set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} )
|
||||||
|
@ -66,7 +65,6 @@ target_link_libraries( grive
|
||||||
${CURL_LIBRARIES}
|
${CURL_LIBRARIES}
|
||||||
${JSONC_LIBRARY}
|
${JSONC_LIBRARY}
|
||||||
${OPENSSL_LIBRARIES}
|
${OPENSSL_LIBRARIES}
|
||||||
${ATTR_LIBRARY}
|
|
||||||
${OPT_LIBS}
|
${OPT_LIBS}
|
||||||
expat
|
expat
|
||||||
)
|
)
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
// OS specific headers
|
// OS specific headers
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <attr/xattr.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -85,26 +84,7 @@ void SetFileTime( const std::string& filename, const DateTime& t )
|
||||||
{
|
{
|
||||||
struct timeval tvp[2] = { t.Tv(), t.Tv() } ;
|
struct timeval tvp[2] = { t.Tv(), t.Tv() } ;
|
||||||
if ( ::utimes( filename.c_str(), tvp ) != 0 )
|
if ( ::utimes( filename.c_str(), tvp ) != 0 )
|
||||||
throw Exception() << expt::ErrMsg( "cannot set file time" ) ;
|
throw 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 ) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} } // end of namespaces
|
} } // end of namespaces
|
||||||
|
|
|
@ -40,11 +40,6 @@ namespace os
|
||||||
|
|
||||||
void SetFileTime( const std::string& filename, const DateTime& t ) ;
|
void SetFileTime( const std::string& filename, const DateTime& t ) ;
|
||||||
void SetFileTime( const Path& 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
|
} // end of namespaces
|
||||||
|
|
Loading…
Reference in New Issue