summaryrefslogtreecommitdiff
path: root/src/Util
diff options
context:
space:
mode:
authorDongeup Ham <dongeup.ham@samsung.com>2012-11-01 15:59:21 +0900
committerDongeup Ham <dongeup.ham@samsung.com>2012-11-01 15:59:21 +0900
commit36978384db34cfb0e39ef70a25b9d7b5b3677831 (patch)
treeed35f827eb80d0685445140edeebf15b118166c1 /src/Util
parent38b877649556347d2ecbb8e0db67a1ca8e883b7a (diff)
downloadinstaller-36978384db34cfb0e39ef70a25b9d7b5b3677831.tar.gz
installer-36978384db34cfb0e39ef70a25b9d7b5b3677831.tar.bz2
installer-36978384db34cfb0e39ef70a25b9d7b5b3677831.zip
Installer Logs are modified.
Change-Id: Ib15a4e13eb3fa9653ce0712d96529b2df98d1375
Diffstat (limited to 'src/Util')
-rwxr-xr-xsrc/Util/InstallerUtil.cpp44
-rwxr-xr-xsrc/Util/InstallerUtil.h4
2 files changed, 34 insertions, 14 deletions
diff --git a/src/Util/InstallerUtil.cpp b/src/Util/InstallerUtil.cpp
index 325231c..00ebd93 100755
--- a/src/Util/InstallerUtil.cpp
+++ b/src/Util/InstallerUtil.cpp
@@ -56,23 +56,23 @@ InstallerUtil::Remove(const Osp::Base::String& filePath)
TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
err = lstat(pFilePath.get(), &fileinfo);
- TryReturn(err >= 0, false, "[osp-installer] lstat() failed, filepath=%s", pFilePath.get());
+ TryReturn(err >= 0, false, "[osp-installer] lstat() failed, filepath = [%s]", pFilePath.get());
if (S_ISLNK(fileinfo.st_mode))
{
- AppLogTag(OSP_INSTALLER, "remove symlink, pFilePath=%s", pFilePath.get());
+ AppLogTag(OSP_INSTALLER, "Remove(): symlink, pFilePath=%s", pFilePath.get());
err = unlink(pFilePath.get());
- TryReturn(err >= 0, false, "[osp-installer] unlink() failed, filepath=%s", pFilePath.get());
+ TryReturn(err >= 0, false, "[osp-installer] unlink() failed, filepath = [%s]", pFilePath.get());
}
else if (S_ISDIR(fileinfo.st_mode))
{
- AppLogTag(OSP_INSTALLER, "remove directory, filePath=%ls", filePath.GetPointer());
+ AppLogTag(OSP_INSTALLER, "Remove(): directory, filePath=%ls", filePath.GetPointer());
r = Directory::Remove(filePath, true);
TryReturn(!IsFailed(r), false, "[osp-installer] Directory::Remove() failed, filePath=%ls", filePath.GetPointer());
}
else
{
- AppLogTag(OSP_INSTALLER, "remove file, filePath=%ls", filePath.GetPointer());
+ AppLogTag(OSP_INSTALLER, "Remove(): file, filePath=%ls", filePath.GetPointer());
r = File::Remove(filePath);
TryReturn(!IsFailed(r), false, "[osp-installer] File::Remove() failed, filePath=%ls", filePath.GetPointer());
}
@@ -179,7 +179,7 @@ InstallerUtil::IsSymlink(const Osp::Base::String& filePath)
TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
err = lstat(pFilePath.get(), &fileinfo);
- TryReturn(err >= 0, false, "[osp-installer] lstat() failed, filepath=%s", pFilePath.get());
+ TryReturn(err >= 0, false, "[osp-installer] lstat() failed, filepath = [%s]", pFilePath.get());
if (S_ISLNK(fileinfo.st_mode))
{
@@ -205,7 +205,7 @@ InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath)
TryReturn(pNewPath, false, "[osp-installer] pNewPath is null");
err = symlink(pOldPath.get(), pNewPath.get());
- TryReturn(err == 0, false, "[osp-installer] symlink() is failed, oldpath=(%s), newpath=(%s)", pOldPath.get(), pNewPath.get());
+ TryReturn(err == 0, false, "[osp-installer] symlink() is failed, oldpath = [%s], newpath = [%s]", pOldPath.get(), pNewPath.get());
return true;
}
@@ -219,7 +219,7 @@ InstallerUtil::ChangeMode(const String& filePath, int mode)
TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
err = chmod(pFilePath.get(), mode);
- TryReturn(err == 0, false, "[osp-installer] chmod() is failed, filepath=[%s], mode=[%o]", pFilePath.get(), mode);
+ TryReturn(err == 0, false, "[osp-installer] chmod() is failed, filepath = [%s], mode = [%o]", pFilePath.get(), mode);
return true;
}
@@ -233,7 +233,7 @@ InstallerUtil::ChangeOwner(const String& filePath)
TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
err = chown(pFilePath.get(), APP_OWNER_ID, APP_GROUP_ID);
- TryReturn(err == 0, false, "[osp-installer] chown() is failed, filepath=[%s]", pFilePath.get());
+ TryReturn(err == 0, false, "[osp-installer] chown() is failed, filepath = [%s]", pFilePath.get());
return true;
}
@@ -242,12 +242,16 @@ bool
InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode)
{
result r = E_SUCCESS;
+ bool res = false;
+
+ res = File::IsFileExist(filePath);
+ TryReturn(res == true, false, "[osp-installer] file not found, filePath = [%ls]", filePath.GetPointer());
std::unique_ptr<Directory> pDir(new Directory);
TryReturn(pDir, false, "[osp-installer] pDir is null.");
r = pDir->Construct(filePath);
- TryReturn(!IsFailed(r), false, "[osp-installer] pDir->Construct() failed, filePath=[%ls].", filePath.GetPointer());
+ TryReturn(!IsFailed(r), false, "[osp-installer] pDir->Construct() failed, filePath = [%ls]", filePath.GetPointer());
std::unique_ptr<DirEnumerator> pDirEnum(pDir->ReadN());
TryReturn(pDirEnum, false, "[osp-installer] pDirEnum is null.");
@@ -288,16 +292,16 @@ InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode)
}
bool
-InstallerUtil::IsDrmFile(const Osp::Base::String& packagePath)
+InstallerUtil::IsDrmFile(const Osp::Base::String& path)
{
- AppLogTag(OSP_INSTALLER, "IsDrmFile() called, packagePath=%ls", packagePath.GetPointer());
+ AppLogTag(OSP_INSTALLER, "IsDrmFile() called, path = [%ls]", path.GetPointer());
return false;
}
bool
InstallerUtil::DecryptPackage(const Osp::Base::String& packagePath)
{
- AppLogTag(OSP_INSTALLER, "DecryptPackage() called, packagePath=%ls", packagePath.GetPointer());
+ AppLogTag(OSP_INSTALLER, "DecryptPackage() called, packagePath = [%ls]", packagePath.GetPointer());
return true;
}
@@ -374,3 +378,17 @@ InstallerUtil::CreateSymlinkForAppId(const String& inPath, String& outPath)
return true;
}
+
+void
+InstallerUtil::Log(const char* pTagName, const char* pFormat, ...)
+{
+ va_list args;
+
+ va_start(args, pFormat);
+
+ AppLogTagInternal(OSP_INSTALLER, "", 0, pFormat, args);
+
+ va_end(args);
+
+}
+
diff --git a/src/Util/InstallerUtil.h b/src/Util/InstallerUtil.h
index 5733386..0386ae5 100755
--- a/src/Util/InstallerUtil.h
+++ b/src/Util/InstallerUtil.h
@@ -54,12 +54,14 @@ public:
static bool ChangeOwner(const Osp::Base::String& filePath);
static bool ChangeDirectoryPermission(const Osp::Base::String& filePath, int mode);
- static bool IsDrmFile(const Osp::Base::String& packagePath);
+ static bool IsDrmFile(const Osp::Base::String& path);
static bool DecryptPackage(const Osp::Base::String& packagePath);
static Osp::Base::String GetCategory(int categoryType);
static CategoryType GetCategoryType(char* pCategory);
+ static void Log(const char* pTagName, const char* pFormat, ...);
+
private:
InstallerUtil(const InstallerUtil& value);
InstallerUtil& operator =(const InstallerUtil& source);