2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file PreloadedInstaller.cpp
19 * @brief This is the implementation file for %PreloadedInstaller class.
23 #include <FIoDirectory.h>
26 #include "PreloadedInstaller.h"
27 #include "InstallerUtil.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Io;
32 PreloadedInstaller::PreloadedInstaller(void)
36 PreloadedInstaller::~PreloadedInstaller(void)
41 PreloadedInstaller::GetNext(InstallationStep step)
43 return DirectoryInstaller::GetNext(step);
47 PreloadedInstaller::OnInit(void)
49 InstallationContext* pContext = GetContext();
50 String path = pContext->__inputPath;
52 String prefix(PATH_USR_APPS);
55 path.SubString(prefix.GetLength(), PACKAGE_ID_LENGTH, appId);
57 String destRootPath(PATH_OPT_USR_APPS);
59 destRootPath += appId;
61 Directory::Create(destRootPath);
67 srcPath = path + DIR_SETTING;
68 destPath = destRootPath + DIR_SETTING;
69 InstallerUtil::CopyDirectory(srcPath, destPath);
72 srcPath = path + DIR_DATA;
73 destPath = destRootPath + DIR_DATA;
74 InstallerUtil::CopyDirectory(srcPath, destPath);
76 srcPath = path + DIR_INFO;
77 destPath = destRootPath + DIR_INFO;
78 InstallerUtil::CreateSymlink(srcPath, destPath);
80 srcPath = path + DIR_BIN;
81 destPath = destRootPath + DIR_BIN;
82 InstallerUtil::CreateSymlink(srcPath, destPath);
84 srcPath = path + DIR_RES;
85 destPath = destRootPath + DIR_RES;
86 InstallerUtil::CreateSymlink(srcPath, destPath);
88 srcPath = path + DIR_LIB;
89 destPath = destRootPath + DIR_LIB;
90 InstallerUtil::CreateSymlink(srcPath, destPath);
92 srcPath = path + DIR_SHARED;
93 destPath = destRootPath + DIR_SHARED;
94 if (File::IsFileExist(srcPath) == true)
96 InstallerUtil::CopyDirectory(srcPath, destPath);
100 Directory::Create(destPath);
105 if (File::IsFileExist(destPath) == false)
107 srcPath = path + DIR_ICONS;
108 InstallerUtil::CreateSymlink(srcPath, destPath);
111 pContext->__installDir = pContext->__inputPath;
112 if ((File::IsFileExist(pContext->GetSignatureXmlPath()) == true) &&
113 (File::IsFileExist(pContext->GetAuthorSignatureXmlPath()) == true))
115 srcPath = path + SIGNATURE1_XML_FILE;
116 destPath = destRootPath + SIGNATURE1_XML_FILE;
117 InstallerUtil::CreateSymlink(srcPath, destPath);
119 srcPath = path + AUTHOR_SIGNATURE_XML_FILE;
120 destPath = destRootPath + AUTHOR_SIGNATURE_XML_FILE;
121 InstallerUtil::CreateSymlink(srcPath, destPath);
123 AppLog("[VerifySignature] VerificationMode ON");
124 pContext->__isVerificationMode = true;
127 pContext->__installDir = destRootPath;
129 return DirectoryInstaller::OnInit();
133 PreloadedInstaller::OnRegister(void)
135 return DirectoryInstaller::OnRegister();
139 PreloadedInstaller::OnEnd(void)
141 return DirectoryInstaller::OnEnd();
145 PreloadedInstaller::OnError(void)
147 AppLog("PreloadedInstaller::OnError()");
148 return DirectoryInstaller::OnError();
152 PreloadedInstaller::OnRollback(void)
154 AppLog("PreloadedInstaller::OnRollback()");
155 return DirectoryInstaller::OnRollback();
159 PreloadedInstaller::OnUserCancel(void)
161 AppLog("PreloadedInstaller::OnUserCancel()");
162 return DirectoryInstaller::OnUserCancel();