function Content(data) {
- var editableAttributes = ['name', 'rating', 'description'];
+ var editableAttributes = ['isFavorite'];
+ // since 5.5 these attributes are readonly, it is disallowed to modify them,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55) {
+ editableAttributes.push('name');
+ editableAttributes.push('rating');
+ editableAttributes.push('description');
+ }
var id;
var name;
var type;
return name;
},
set: function(v) {
- if (!type_.isNull(v)) {
- name = converter_.toString(v, false);
+ // since 5.5 this attribute is readonly, it is disallowed to modify it,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55 || edit_.isAllowed) {
+ if (!type_.isNull(v)) {
+ name = converter_.toString(v, false);
+ }
+ } else {
+ utils_.warn('Since 5.5 "name" attribute is readonly, modifying it has no effect.');
}
},
enumerable: true
return description;
},
set: function(v) {
- description = converter_.toString(v, true);
+ // since 5.5 this attribute is readonly, it is disallowed to modify it,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55 || edit_.isAllowed) {
+ description = converter_.toString(v, true);
+ } else {
+ utils_.warn('Since 5.5 "description" attribute is readonly, modifying it has no effect.');
+ }
},
enumerable: true
},
return rating;
},
set: function(v) {
- if (!type_.isNull(v) && v >= 0 && v <= 10) {
- rating = converter_.toUnsignedLong(v, false);
+ // since 5.5 this attribute is readonly, it is disallowed to modify it,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55 || edit_.isAllowed) {
+ if (!type_.isNull(v) && v >= 0 && v <= 10) {
+ rating = converter_.toUnsignedLong(v, false);
+ }
+ } else {
+ utils_.warn('Since 5.5 "rating" attribute is readonly, modifying it has no effect.');
}
},
enumerable: true
Content.call(this, data);
var editableAttributes = this.editableAttributes;
- editableAttributes.push('geolocation');
+ // since 5.5 this attribute is readonly, it is disallowed to modify it,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55) {
+ editableAttributes.push('geolocation');
+ }
var geolocation;
var album;
return geolocation;
},
set: function(v) {
- if (!type_.isNull(v)) {
- var latitude = converter_.toDouble(v.latitude, false);
- var longitude = converter_.toDouble(v.longitude, false);
- geolocation = new tizen.SimpleCoordinates(latitude, longitude);
+ // since 5.5 this attribute is readonly, it is disallowed to modify it,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55 || edit_.isAllowed) {
+ if (!type_.isNull(v)) {
+ var latitude = converter_.toDouble(v.latitude, false);
+ var longitude = converter_.toDouble(v.longitude, false);
+ geolocation = new tizen.SimpleCoordinates(latitude, longitude);
+ }
+ } else {
+ utils_.warn('Since 5.5 "geolocation" attribute is readonly, modifying it has no effect.');
}
},
enumerable: true
Content.call(this, data);
var editableAttributes = this.editableAttributes;
- editableAttributes.push('geolocation');
- editableAttributes.push('orientation');
+ // since 5.5 these attributes are readonly, it is disallowed to modify them,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55) {
+ editableAttributes.push('geolocation');
+ editableAttributes.push('orientation');
+ }
var geolocation;
var width;
return geolocation;
},
set: function(v) {
- if (!type_.isNull(v)) {
- var latitude = converter_.toDouble(v.latitude, false);
- var longitude = converter_.toDouble(v.longitude, false);
- geolocation = new tizen.SimpleCoordinates(latitude, longitude);
+ // since 5.5 this attribute is readonly, it is disallowed to modify it,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55 || edit_.isAllowed) {
+ if (!type_.isNull(v)) {
+ var latitude = converter_.toDouble(v.latitude, false);
+ var longitude = converter_.toDouble(v.longitude, false);
+ geolocation = new tizen.SimpleCoordinates(latitude, longitude);
+ }
+ } else {
+ utils_.warn('Since 5.5 "geolocation" attribute is readonly, modifying it has no effect.');
}
},
enumerable: true
return orientation;
},
set: function(v) {
- if (!type_.isNull(v)) {
- orientation = converter_.toEnum(v, Object.keys(ImageContentOrientation), false);
+ // since 5.5 this attribute is readonly, it is disallowed to modify it,
+ // but for applications developed for earlier versions backward compatibility
+ // is kept
+ if (isEarlierThan55 || edit_.isAllowed) {
+ if (!type_.isNull(v)) {
+ orientation = converter_.toEnum(v, Object.keys(ImageContentOrientation), false);
+ }
+ } else {
+ utils_.warn('Since 5.5 "orientation" attribute is readonly, modifying it has no effect.');
}
},
enumerable: true
*/
#include "filesystem/filesystem_manager.h"
-
#include <app_manager.h>
#include <dirent.h>
#include <fcntl.h>
SCOPE_EXIT {
(void)closedir(dp);
};
- errno = 0;
- struct dirent* entry = nullptr;
- while (nullptr != (entry = readdir(dp))) {
- if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) continue;
+
+ while (true) {
+ errno = 0;
+ struct dirent* entry = readdir(dp);
+ int readdir_errno = errno;
+ if (0 != readdir_errno) {
+ LoggerE("readdir() error message: %s", strerror(readdir_errno));
+ return FilesystemError::Other;
+ }
+
+ if (nullptr == entry) {
+ LoggerD("No more entries in the directory");
+ break;
+ }
+
+ if (std::strcmp(entry->d_name, ".") == 0 || std::strcmp(entry->d_name, "..") == 0) {
+ LoggerD("Skipping %s directory", entry->d_name);
+ continue;
+ }
std::string oldLocation = originPath + std::string("/") + std::string(entry->d_name);
std::string newLocation = destPath + std::string("/") + std::string(entry->d_name);
+
FilesystemError fstatus = FilesystemError::None;
if (entry->d_type == DT_DIR) {
fstatus = copyDirectory(oldLocation, newLocation);
}
}
- if (0 != errno) {
- LoggerE("error occured");
- return FilesystemError::Other;
- }
return FilesystemError::None;
}