]> git.tdb.fi Git - builder.git/blobdiff - source/androidtools.cpp
Use getenv from mspcore
[builder.git] / source / androidtools.cpp
index 93b7bfac7a05d941f128ab55fcf05c088736e51d..118926e1aa3e29dd277d77f138090c65305536b2 100644 (file)
@@ -1,4 +1,4 @@
-#include <cstdlib>
+#include <msp/core/environ.h>
 #include <msp/fs/dir.h>
 #include <msp/fs/stat.h>
 #include <msp/strings/format.h>
@@ -36,14 +36,16 @@ AndroidDevKit::AndroidDevKit(Builder &b, const string &type, const FS::Path &def
        builder(b)
 {
        string var = format("ANDROID_%s_ROOT", type);
-       if(const char *value = getenv(var.c_str()))
-               root = value;
-       else if(!default_path.empty() && FS::exists(default_path))
-               root = default_path;
-       else
+       root = getenv(var);
+       if(root.empty())
        {
-               builder.get_logger().log("problems", format("Android %s not found", type));
-               return;
+               if(!default_path.empty() && FS::exists(default_path))
+                       root = default_path;
+               else
+               {
+                       builder.get_logger().log("problems", format("Android %s not found", type));
+                       return;
+               }
        }
 
        FS::Path platforms_dir = root/"platforms";