[Cpplint] Re-enable style checker for download and fix some errors.
[platform/framework/web/tizen-extensions-crosswalk.git] / download / download_instance_desktop.cc
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "download/download_instance.h"
6
7 #include <pwd.h>
8 #include <stdlib.h>
9 #include <sys/types.h>
10 #include <unistd.h>
11
12 std::string DownloadInstance::GetFullDestinationPath(
13     const std::string destination) const {
14   std::string path(getenv("HOME"));
15   if (path.empty()) {
16     struct passwd password_entry;
17     struct passwd* password_entry_ptr;
18     char buf[1024];
19     if (!getpwuid_r(getuid(), &password_entry,
20                     buf, sizeof buf, &password_entry_ptr)) {
21       path = password_entry.pw_dir;
22     }
23   }
24   return (path + '/' + destination);
25 }