diff --git a/assets/gap.js b/assets/gap.js index 30236518..b15b0923 100644 --- a/assets/gap.js +++ b/assets/gap.js @@ -306,7 +306,30 @@ var Device = { get: function(url, file) { window.DroidGap.httpGet(url, file); } - } + }, + storage: { + result: "", + testSDCard: function(){ + Device.storage.result = window.DroidGap.testSaveLocationExists(); + return Device.storage.result; + }, + testExistence: function(file){ + Device.storage.result = window.DroidGap.testDirOrFileExists(file); + return Device.storage.result; + }, + delFile: function(file){ + Device.storage.result = window.DroidGap.deleteFile(file); + return Device.storage.result; + }, + delDir: function(file){ + Device.storage.result = window.DroidGap.deleteDirectory(file); + return Device.storage.result; + }, + createDir: function(file){ + Device.storage.result = window.DroidGap.createDirectory(file); + return Device.storage.result; + } + } } function gotLocation(lat, lon) { diff --git a/assets/index.html b/assets/index.html index d069a134..a5ff8e48 100644 --- a/assets/index.html +++ b/assets/index.html @@ -108,7 +108,23 @@ http = function(func) Device.http.get($('httpGetUrl').value, $('httpGetFile').value) } } - +fileManagement = function(x){ + if (x == 'testSDCard'){ + $('file_status').value = Device.storage.testSDCard(); + }else + if (x == 'testExistence'){ + $('file_status').value = Device.storage.testExistence($('checkfile').value); + }else + if (x == 'createDir'){ + $('file_status').value = Device.storage.createDir($('createfile').value); + }else + if (x == 'delFile'){ + $('file_status').value = Device.storage.delFile($('delfile').value); + }else + if (x == 'delDir'){ + $('file_status').value = Device.storage.delDir($('deldir').value); + } +} addLoadEvent(initGap); @@ -132,6 +148,7 @@ addLoadEvent(initGap);