Code cleanup (#251)
[platform/core/dotnet/launcher.git] / NativeLauncher / tool / tac_common.cc
index a5e0a02..844ad5e 100644 (file)
@@ -219,14 +219,14 @@ tac_error_e restoreTACDB()
 
 tac_error_e resetTACPackage(const std::string& pkgId)
 {
-       std::string pkgRoot;
-       if (getRootPath(pkgId, pkgRoot) < 0) {
+       std::string rootPath = getRootPath(pkgId);
+       if (rootPath.empty()) {
                fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
                return TAC_ERROR_INVALID_PACKAGE;
        }
 
        std::vector<std::string> tacNativeImage;
-       std::string binDir = concatPath(pkgRoot, "bin");
+       std::string binDir = concatPath(rootPath, "bin");
        std::string tacDir = concatPath(binDir, TAC_SYMLINK_SUB_DIR);
        if (bf::exists(tacDir)) {
                try {
@@ -255,13 +255,13 @@ tac_error_e resetTACPackage(const std::string& pkgId)
 
 tac_error_e disableTACPackage(const std::string& pkgId)
 {
-       std::string pkgRoot;
-       if (getRootPath(pkgId, pkgRoot) < 0) {
+       std::string rootPath = getRootPath(pkgId);
+       if (rootPath.empty()) {
                fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
                return TAC_ERROR_INVALID_PACKAGE;
        }
 
-       std::string binDir = concatPath(pkgRoot, "bin");
+       std::string binDir = concatPath(rootPath, "bin");
        std::string tacDir = concatPath(binDir, TAC_SYMLINK_SUB_DIR);
        std::string binNIDir = concatPath(binDir, APP_NI_SUB_DIR);
        if (bf::exists(tacDir)) {
@@ -302,21 +302,21 @@ tac_error_e disableTACPackage(const std::string& pkgId)
 
 tac_error_e enableTACPackage(const std::string& pkgId)
 {
-       std::string rootPath;
-       if (getRootPath(pkgId, rootPath) < 0) {
+       std::string rootPath = getRootPath(pkgId);
+       if (rootPath.empty()) {
                fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
                return TAC_ERROR_INVALID_PACKAGE;
        }
 
-       std::string execName;
-       if (getExecName(pkgId, execName) < 0) {
-               fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
+       std::string execName = getExecName(pkgId);
+       if (execName.empty()) {
+               fprintf(stderr, "Failed to get exec name from [%s]\n", pkgId.c_str());
                return TAC_ERROR_INVALID_PACKAGE;
        }
 
-       std::string metaValue;
-       if (getMetadataValue(pkgId, TAC_METADATA_KEY, metaValue) < 0) {
-               fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
+       std::string metaValue = getMetadataValue(pkgId, TAC_METADATA_KEY);
+       if (metaValue.empty()) {
+               fprintf(stderr, "Failed to get metadata from [%s]\n", pkgId.c_str());
                return TAC_ERROR_INVALID_PACKAGE;
        }