_AudioContentInfoImpl::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
{
result r = E_SUCCESS;
- int contentLength = 0;
- FileAttributes attribute;
+ String tempPath(contentPath);
+
+ if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+ {
+ if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
+ {
+ // Because the content path is saved like /opt/media or /opt/storage/sdcard/ in SLP database,
+ // it should be converted in 2.0.
+ r = tempPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
+ SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+ }
+ else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
+ {
+ r = tempPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
+ SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Construct() failed.");
+ }
+ else
+ {
+ SysLogException(NID_CNT, E_INVALID_ARG,
+ "[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media.");
+ return E_INVALID_ARG;
+ }
+ }
// checks parameters
- contentLength = contentPath.GetLength();
SysTryReturnResult(NID_CNT, _FileImpl::IsMediaPath(contentPath), E_INVALID_ARG,
"The contentPath should start with /Media or /Storagecard/Media.");
SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
SysLog(NID_CNT, "The setGps is not supported.");
}
- SetContentPath(contentPath);
+ SetContentPath(tempPath);
SetContentType(CONTENT_TYPE_AUDIO);
return r;
int length = contentPath.GetLength();
SysTryReturnResult(NID_CNT, length != 0, E_INVALID_ARG,
"The length of pContentPath is 0.");
- SysTryReturnResult(NID_CNT, File::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+ SysTryReturnResult(NID_CNT, File::IsFileExist(*pContentPath), E_FILE_NOT_FOUND,
"The file corresponding to pContentPath could not be found.");
SetContentPath(contentPath);