}
bool
-_FileImpl::CreateOspApplicationDirectories(const String& appRootPath, const String& pkgId) // for 2.1 app
+_FileImpl::CreateOspApplicationDirectories(const String& appRootPath, const String& pkgId) // for 2.0 app
{
+#if 0
struct _OspDir appSubDir[] =
{
- { "./shared\0", 0755, false },
- //{ "./shared/data\0", 0755, true },
- { "./shared/res\0", 0755, false },
- { "./shared/trusted\0", 0755, true },
+ //{ "./shared\0", 0755, false },
+ //{ "./shared/data\0", 0755, true },
+ //{ "./shared/res\0", 0755, false },
+ //{ "./shared/trusted\0", 0755, true },
//{ "./cache\0", 0700, true }
};
int uid = -1;
int ret = 0;
unsigned int i = 0;
result r = E_SUCCESS;
+#endif
SysTryReturn(NID_IO, CleanDirectories(appRootPath, pkgId) == true, false, E_SYSTEM,
"[E_SYSTEM] Failed to clean directories for 2.0 application compatibility.");
+#if 0
unique_ptr<char[]> pAppRootPath(_StringConverter::CopyToCharArrayN(appRootPath));
SysTryReturn(NID_IO, pAppRootPath != null, false, E_SYSTEM, "[E_SYSTEM] The memory is insufficient.");
}
}
- if (access("./shared/data", F_OK) == 0)
- {
- SysTryCatch(NID_IO, system("chown -R 5000:5000 ./shared/data") != -1, , E_SYSTEM,
- "[E_SYSTEM] chown() failed");
- }
- // XXX: Temp code for supporting old share directory.
- else if (access("./share", F_OK) == 0)
- {
- SysTryCatch(NID_IO, system("rm -rf ./shared/data") != -1, , E_SYSTEM,
- "[E_SYSTEM] Failed to remove ./shared/data directory");
-
- SysTryCatch(NID_IO, rename("./share", "./shared/data") == 0, , E_SYSTEM,
- "[E_SYSTEM] Failed to rename share directory (%d, %s)", errno, strerror(errno));
-
- SysTryCatch(NID_IO, system("chown -R 5000:5000 ./shared/data") != -1, , E_SYSTEM,
- "[E_SYSTEM] chown() failed");
-
- SysTryCatch(NID_IO, chmod("./shared/data", 0755) == 0, , E_SYSTEM, "[E_SYSTEM] chmod() failed");
- }
- // XXX-end
-
umask(0022);
SysLog(NID_IO, "_FileImpl::CreateOspApplicationDirectories() succeeded.");
umask(0022);
return false;
+#else
+ return true;
+#endif
+
}
bool
}
#endif
- // XXX: shared directory is not supported for 2.0 applications
+ // XXX: OSP compatible application's data packed in shared/data, shared/trusted directory of SDK
+ // cannot be delivered.
#if 0
if (access("./shared/data", F_OK) == 0)
{
char chownCmd[256] = { 0, };
sprintf(chownCmd, "chown -R 5000:5000 /opt/usr/share/.osp-compat/share/%ls/", pkgId.GetPointer());
SysTryReturn(NID_IO, system(chownCmd) != -1, false, E_SYSTEM, "[E_SYSTEM] chown() failed");
-
- char symlinkCmd[256] = { 0, };
- sprintf(symlinkCmd, "ln -s %s ./shared/data", pOspShareAppIdPath.get());
- SysTryReturn(NID_IO, system(symlinkCmd) != -1, false, E_SYSTEM, "[E_SYSTEM] symlink() failed");
}
#endif
- char symlinkCmd[256] = { 0, };
- sprintf(symlinkCmd, "ln -s %s ./shared/data", pOspShareAppIdPath.get());
- SysTryReturn(NID_IO, system(symlinkCmd) != -1, false, E_SYSTEM, "[E_SYSTEM] symlink() failed");
+ ret = remove("./shared/data");
+ SysTryReturn(NID_IO, ret == 0 || errno == ENOENT, false, E_SYSTEM,
+ "[E_SYSTEM] remove() failed, errno: %d (%s), path: ./shared/data", errno, strerror(errno));
+ ret = remove("./shared/trusted");
+ SysTryReturn(NID_IO, ret == 0 || errno == ENOENT, false, E_SYSTEM,
+ "[E_SYSTEM] remove() failed, errno: %d (%s), path: ./shared/trusted", errno, strerror(errno));
+
+ ret = symlink(pOspShareAppIdPath.get(), "./shared/data");
+ SysTryReturn(NID_IO, ret == 0, false, E_SYSTEM,
+ "[E_SYSTEM] symlink() failed, errno: %d (%s), link: ./shared/data -> %s",
+ errno, strerror(errno), pOspShareAppIdPath.get());
+ ret = symlink(pOspShare2AppIdPath.get(), "./shared/trusted");
+ SysTryReturn(NID_IO, ret == 0, false, E_SYSTEM,
+ "[E_SYSTEM] symlink() failed, errno: %d (%s), link: ./shared/trusted -> %s",
+ errno, strerror(errno), pOspShare2AppIdPath.get());
return true;
}