For about a month now I've been trying to create a directory to save images to on my tizen web app for my Samsung Watch, but nothing has worked. Below are the snipets of code that I've tried on tizen's web simulator and on my watch:
var success = function(dir) {
dir.createDirectory('AFG');
alert('yay');
};
var error = function(e) {
alert('Error: ' + e.message);
};
tizen.filesystem.resolve('images', success, error);
Result:
On web simulator: 'newDir' folder nowhere to be found.
On watch : Error: Platform Error.
var successCallback = function(newPath) {
alert('New directory has been created: ' + newPath);
};
var errorCallback = function(error) {
alert(error);
};
tizen.filesystem.createDirectory('images/newDir', successCallback, errorCallback);
Result:
On web simulator:
Uncaught TypeError: tizen.filesystem.createDirectory is not a function
at HTMLAnchorElement.<anonymous> (add.js:73)
at _raiseTouchEvent (ripple.js:155080)
(anonymous) @ add.js:73
_raiseTouchEvent @ ripple.js:155080
On watch: No feedback and no 'newDir' folder created in opt/usr/media/Images
Note: I have both privileges enabled:
http://tizen.org/privilege/filesystem.write
http://tizen.org/privilege/filesystem.read
Any help would be greatly appreciated. Thanks!
Your first code snippet is correct and it is supposed to create the directory:
var success = function(dir) {
dir.createDirectory('AFG');
alert('yay');
};
var error = function(e) {
alert('Error: ' + e.message);
};
tizen.filesystem.resolve('images', success, error);
You should find the newly created directory in this location: /opt/usr/media/Images/