Merge "[DCM-1209]if path is empty, query can not be set." into tizen_2.1
[platform/framework/native/appfw.git] / src / system / FSys_EnvironmentImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FSys_EnvironmentImpl.cpp
20  * @brief       This is the implementation file for %_EnvironmentImpl class.
21  */
22
23 #include <FBaseSysLog.h>
24
25 #include "FSys_EnvironmentImpl.h"
26
27 using namespace Tizen::Base;
28
29 namespace Tizen { namespace System
30 {
31
32 static const wchar_t _MEDIA_PATH[] = L"/opt/usr/media/";
33 static const wchar_t _MEDIA_IMAGES_PATH[] = L"/opt/usr/media/Images/";
34 static const wchar_t _MEDIA_SOUNDS_PATH[] = L"/opt/usr/media/Sounds/";
35 static const wchar_t _MEDIA_VIDEOS_PATH[] = L"/opt/usr/media/Videos/";
36 static const wchar_t _MEDIA_CAMERA_PATH[] = L"/opt/usr/media/Camera/";
37 static const wchar_t _MEDIA_DOWNLOADS_PATH[] = L"/opt/usr/media/Downloads/";
38 static const wchar_t _MEDIA_OTHERS_PATH[] = L"/opt/usr/media/Others/";
39
40 static const wchar_t _EXTERNAL_MMC_PATH[] = L"/opt/storage/sdcard/";
41 static const wchar_t _EXTERNAL_MMC_IMAGES_PATH[] = L"/opt/storage/sdcard/Images/";
42 static const wchar_t _EXTERNAL_MMC_SOUNDS_PATH[] = L"/opt/storage/sdcard/Sounds/";
43 static const wchar_t _EXTERNAL_MMC_VIDEOS_PATH[] = L"/opt/storage/sdcard/Videos/";
44 static const wchar_t _EXTERNAL_MMC_CAMERA_PATH[] = L"/opt/storage/sdcard/Camera/";
45 static const wchar_t _EXTERNAL_MMC_DOWNLOADS_PATH[] = L"/opt/storage/sdcard/Downloads/";
46 static const wchar_t _EXTERNAL_MMC_OTHERS_PATH[] = L"/opt/storage/sdcard/Others/";
47 static const wchar_t _RINGTONE_PATH[] = L"/opt/share/settings/Ringtones";
48
49 static const wchar_t _APPLICATIONS_PATH[] = L"/opt/usr/apps/";
50 static const wchar_t _EXTERNAL_APPLICATIONS_PATH[] = L"/opt/storage/sdcard/app2sd/";
51
52 static const wchar_t _COMPAT_SHARED_PATH[] = L"/opt/usr/share/.osp-compat/";
53
54 _EnvironmentImpl::_EnvironmentImpl(void)
55 {
56 }
57
58 _EnvironmentImpl::~_EnvironmentImpl(void)
59 {
60 }
61
62 String
63 _EnvironmentImpl::GetMediaPath(void)
64 {
65         static String mediaPath(_MEDIA_PATH);
66     return mediaPath;
67 }
68
69 String
70 _EnvironmentImpl::GetDefaultDownloadPath(void)
71 {
72         static String downloadPath(_MEDIA_DOWNLOADS_PATH);
73     return downloadPath;
74 }
75
76 String
77 _EnvironmentImpl::GetExternalStoragePath(void)
78 {
79         static String externalStoragePath(_EXTERNAL_MMC_PATH);
80         return externalStoragePath;
81 }
82
83 String
84 _EnvironmentImpl::GetOspCompatSharedPath(void)
85 {
86         static String ospCompatSharedPath(_COMPAT_SHARED_PATH);
87         return ospCompatSharedPath;
88 }
89
90 String
91 _EnvironmentImpl::GetPredefinedPath(PredefinedDirectoryType dirType)
92 {
93         switch (dirType)
94         {
95                 case PREDEFINED_DIRECTORY_IMAGES:
96                 {
97                          String path(_MEDIA_IMAGES_PATH);
98                         return path;
99                 }
100                 case PREDEFINED_DIRECTORY_SOUNDS:
101                 {
102                         static String path(_MEDIA_SOUNDS_PATH);
103                         return path;
104                 }
105                 case PREDEFINED_DIRECTORY_VIDEOS:
106                 {
107                         static String path(_MEDIA_VIDEOS_PATH);
108                         return path;
109                 }
110                 case PREDEFINED_DIRECTORY_CAMERA:
111                 {
112                         static String path(_MEDIA_CAMERA_PATH);
113                         return path;
114                 }
115                 case PREDEFINED_DIRECTORY_DOWNLOADS:
116                 {
117                         static String path(_MEDIA_DOWNLOADS_PATH);
118                         return path;
119                 }
120                 case PREDEFINED_DIRECTORY_OTHERS:
121                 {
122                         static String path(_MEDIA_OTHERS_PATH);
123                         return path;
124                 }
125                 case PREDEFINED_DIRECTORY_SYSTEM_RINGTONES:
126                 {
127                         static String path(_RINGTONE_PATH);
128                 }
129                 case PREDEFINED_DIRECTORY_EXTERNAL_IMAGES:
130                 {
131                         static String path(_EXTERNAL_MMC_IMAGES_PATH);
132                         return path;
133                 }
134                 case PREDEFINED_DIRECTORY_EXTERNAL_SOUNDS:
135                 {
136                         static String path(_EXTERNAL_MMC_SOUNDS_PATH);
137                         return path;
138                 }
139                 case PREDEFINED_DIRECTORY_EXTERNAL_VIDEOS:
140                 {
141                         static String path(_EXTERNAL_MMC_VIDEOS_PATH);
142                         return path;
143                 }
144                 case PREDEFINED_DIRECTORY_EXTERNAL_CAMERA:
145                 {
146                         static String path(_EXTERNAL_MMC_CAMERA_PATH);
147                         return path;
148                 }
149                 case PREDEFINED_DIRECTORY_EXTERNAL_DOWNLOADS:
150                 {
151                         static String path(_EXTERNAL_MMC_DOWNLOADS_PATH);
152                         return path;
153                 }
154                 case PREDEFINED_DIRECTORY_EXTERNAL_OTHERS:
155                 {
156                         static String path(_EXTERNAL_MMC_OTHERS_PATH);
157                         return path;
158                 }
159                 case PREDEFINED_DIRECTORY_APPLICATIONS:
160                 {
161                         static String path(_APPLICATIONS_PATH);
162                         return path;
163                 }
164                 case PREDEFINED_DIRECTORY_EXTERNAL_APPLICATIONS:
165                 {
166                         static String path(_EXTERNAL_APPLICATIONS_PATH);
167                         return path;
168                 }
169                 default:
170                         return String(L"");
171         }
172 }
173
174 }} // Tizen::System
175