Skip to content

Compile on OS X #2

Merged
merged 4 commits into from Apr 29, 2012
View
4 .gitignore
@@ -1,2 +1,6 @@
.kdev4
grive.kdev4
+
+.project
+.cproject
+build/
View
16 src/main.cc
@@ -27,6 +27,9 @@
#include <iostream>
#include <iterator>
+#include <exception>
+#include <stdexcept>
+
const std::string client_id = "22314510474.apps.googleusercontent.com" ;
const std::string client_secret = "bl4ufi89h-9MkFlypcI7R785" ;
@@ -102,8 +105,17 @@ int main( int argc, char **argv )
}
}
- OAuth2 token( config["refresh_token"].As<std::string>(), client_id, client_secret ) ;
- Drive drive( token ) ;
+ try
+ {
+ OAuth2 token( config["refresh_token"].As<std::string>(), client_id, client_secret ) ;
+ Drive drive( token ) ;
+ }
+ catch ( const std::runtime_error& error )
+ {
+ std::cerr << "Please run grive with the \"-a\" option if this is the "
+ << "first time you're accessing your Google Drive!\n";
+ return -1;
+ }
return 0 ;
}
View
6 src/util/OS.cc
@@ -40,7 +40,11 @@ DateTime FileMTime( const std::string& filename )
if ( ::stat( filename.c_str(), &s ) != 0 )
throw std::runtime_error( "cannot get file attribute of " + filename ) ;
- return DateTime( s.st_mtim.tv_sec, s.st_mtim.tv_nsec ) ;
+#ifdef __APPLE__ && __DARWIN_64_BIT_INO_T
+ return DateTime( s.st_mtimespec.tv_sec, s.st_mtimespec.tv_nsec ) ;
+#else
+ return DateTime( s.st_mtim.tv_sec, s.st_mtim.tv_nsec);
+#endif
}
void SetFileTime( const std::string& filename, const DateTime& t )
Something went wrong with that request. Please try again.