[vlmc-devel] [PATCH 3/3] Added libjsoncpp dependency.

Paweł Wegner pawel.wegner95 at gmail.com
Wed May 4 22:25:12 CEST 2016


---
 configure.ac        |  5 ++++-
 src/GoogleDrive.cpp | 10 +++++++---
 src/Makefile.am     |  4 ++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index b152a82..98385c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,10 @@ AC_PROG_CXX
 AX_CXX_COMPILE_STDCXX_11
 
 PKG_CHECK_MODULES([libcurlpp], [curlpp], [have_libcurlpp=yes], [have_libcurlpp=no])
-AM_CONDITIONAL([libcurlpp], [test "$have_libcurlpp" = "yes"])
+AS_IF([test "$have_libcurlpp" != "yes"], [AC_MSG_ERROR([Unable to find libcurlpp])])
+
+PKG_CHECK_MODULES([libjsoncpp], [jsoncpp], [have_jsoncpp=yes], [have_jsoncpp=no])
+AS_IF([test "$have_jsoncpp" != "yes"], [AC_MSG_ERROR([Unable to find jsoncpp])])
 
 AC_CONFIG_FILES([
   Makefile
diff --git a/src/GoogleDrive.cpp b/src/GoogleDrive.cpp
index f2ac437..a541685 100644
--- a/src/GoogleDrive.cpp
+++ b/src/GoogleDrive.cpp
@@ -1,5 +1,6 @@
 #include "GoogleDrive.h"
 
+#include <jsoncpp/json/json.h>
 #include <curlpp/Easy.hpp>
 #include <curlpp/Options.hpp>
 #include <sstream>
@@ -12,15 +13,18 @@ GoogleDrive::GoogleDrive() {
   curlpp::Easy request;
   std::stringstream stream;
   curlpp::options::WriteStream ws(&stream);
-  request.setOpt<Url>("https://www.googleapis.com/auth/drive");
+  request.setOpt<Url>("https://www.googleapis.com/drive/v3/files");
   request.setOpt(ws);
   request.perform();
-  assert(stream.str() == "drive");
+
+  Json::Value root;
+  stream >> root;
+  assert(root["error"]["code"].asInt() == 403);
 }
 
 // TODO
 std::vector<ICloudStorage::File> GoogleDrive::listDirectory(
-    const std::string& path) const {
+    const std::string&) const {
   return {};
 }
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b7b8aa..d823d9c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,11 +1,11 @@
 ACLOCAL_AMFLAGS = -I m4
 
-AM_CXXFLAGS = $(libcurlpp_CXXFLAGS)
+AM_CXXFLAGS = $(libcurlpp_CXXFLAGS) $(libjsoncpp_LIBS)
 
 lib_LTLIBRARIES = libcloudstorage.la
 libcloudstorage_la_SOURCES = \
 	ICloudStorage.cpp ICloudStorage.h \
 	GoogleDrive.cpp GoogleDrive.h
 
-libcloudstorage_la_LIBADD = $(libcurlpp_LIBS)
+libcloudstorage_la_LIBADD = $(libcurlpp_LIBS) $(libjsoncpp_LIBS)
 
-- 
2.7.4



More information about the Vlmc-devel mailing list