5c723a2cbeeccc43bf579bc1274e885c828d7a5b
[platform/framework/web/crosswalk.git] / src / xwalk / experimental / native_file_system / virtual_root_provider_tizen.cc
1 // Copyright (c) 2014 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 "xwalk/experimental/native_file_system/virtual_root_provider.h"
6
7 #include <tzplatform_config.h>
8
9 #include <map>
10 #include <string>
11
12 VirtualRootProvider::VirtualRootProvider() {
13   const char* names[] = {
14       "CAMERA",
15       "DOCUMENTS",
16       "IMAGES",
17       "SOUNDS",
18       "VIDEOS",
19   };
20
21   tzplatform_variable dirs[] = {
22       TZ_USER_CAMERA,
23       TZ_USER_DOCUMENTS,
24       TZ_USER_IMAGES,
25       TZ_USER_SOUNDS,
26       TZ_USER_VIDEOS
27   };
28
29   for (unsigned int i = 0; i < sizeof(names) / sizeof(names[0]); ++i) {
30     virtual_root_map_[names[i]] =
31         base::FilePath::FromUTF8Unsafe(
32             std::string(tzplatform_getenv(dirs[i])));
33   }
34
35   virtual_root_map_["RINGTONES"] =
36       base::FilePath::FromUTF8Unsafe(
37           std::string(tzplatform_mkpath(TZ_USER_SHARE, "settings/Ringtones")));
38 }