【发布时间】:2015-06-16 18:45:19
【问题描述】:
我需要您帮助了解如何从 Tizen 智能电视的外部 USB 存储中写入和读取文件。检测到问题就开始了
`
/**
* Hello World Sample Project
*/
// import Label component
var Label = caph.require('ui.base.component.Label');
caph.app.addScene('main', $class({
$extends : caph.require('ui.base.Scene'),
// oncreate is called when the scene is created
oncreate : function() {
// add "Hello World"
this.addChild(new Label({
text : 'Hello World',
size : [ 500, 100 ],
position : [ 300, 400 ]
}).setTextSize('72px').setStyle({
backgroundColor : 'red',
color : 'white'
}));
/// Here the filesystem showd show me all the storages
tizen.filesystem.listStorages(checkCorruptedRemovableDrives);
}
})).run();
`
这里是 Success 回调,它显示我有多少存储空间。 ` /* 成功事件处理程序 */ var checkCorruptedRemovableDrives = function(storages) {
/// Here I will kow how much storages I have
console.log(storages.length);
for (var i = 0; i < storages.length; i++) {
if (storages[i].type != "EXTERNAL")
continue;
if (storages[i].state == "UNMOUNTABLE")
console.log("External drive " + storages[i].label + " is corrupted.");
}
};
`
这是出现错误时抛出的方法,它永远不会被调用。
var checkCorruptedRemovableDrivesError = function(storages){
console.log("Error");
}
现在,控制台输出是一个简单的0,这意味着我没有存储空间(但我安装了内部的一个和两个 USB)。
有没有人遇到过这个问题或对如何解决有任何想法?
【问题讨论】:
标签: api filesystems mount tizen samsung-smart-tv