Bug fix and authoring
[src/app-framework-main.git] / src / wgtpkg-install.c
index 6a4a865..b3e4603 100644 (file)
@@ -1,6 +1,8 @@
 /*
  Copyright 2015 IoT.bzh
 
+ author: José Bollo <jose.bollo@iot.bzh>
+
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
@@ -17,7 +19,6 @@
 #define _GNU_SOURCE
 
 #include <errno.h>
-#include <syslog.h>
 #include <string.h>
 #include <ctype.h>
 #include <assert.h>
@@ -28,6 +29,7 @@
 #include "wgt.h"
 #include "wgt-info.h"
 #include "secmgr-wrap.h"
+#include "utils-dir.h"
 
 static int check_defined(const void *data, const char *name)
 {
@@ -126,7 +128,8 @@ static int install_icon(const struct wgt_desc *desc)
        char target[PATH_MAX];
        int rc;
 
-       rc = snprintf(link, sizeof link, "%s/%s@%s", ICONDESTDIR, desc->id, desc->version);
+       create_directory(FWK_ICON_DIR, 0755, 1);
+       rc = snprintf(link, sizeof link, "%s/%s@%s", FWK_ICON_DIR, desc->id, desc->version);
        if (rc >= sizeof link) {
                ERROR("link to long in install_icon");
                errno = EINVAL;
@@ -221,6 +224,7 @@ void install_widget(const char *wgtfile, const char *root, int force)
        NOTICE("-- INSTALLING widget %s --", wgtfile);
 
        /* workdir */
+       create_directory(root, 0755, 1);
        if (make_workdir_base(root, "TMP", 0)) {
                ERROR("failed to create a working directory");
                goto error1;