I was downloading files using Cordova File, Cordova FileTransfer and Cordova Device API and checked all of those inside windows XDK app but cordova.file
is undefined inside cordova crosswalk builds, I use same version and same code in Cordova windows build (using cmd) and it works.
Intel XDK ver 1621
org.apache.cordova.file: 1.3.2
my html at end of body:
<script src="./cordova.js"></script>
<script src="./intelxdk.js"></script>
<script>
function onDeviceReady() {
console.log(cordova.file);
alert(cordova.file);
}
document.addEventListener("deviceready", onDeviceReady, false);
</script>
Is there other solution to get cordova.file.dataDirectory
?
or I can just wait for another release to manage that?
Just for reference:
org.apache.cordova.file
version used in XDK(1621) is 1.1.0 and it doesn't have cordova.file
so I changed File plugin version in XDK to 1.3.2 and no result since using Emulator or Debugger (using XDK Crosswalk app)
I'm sure that File plugin is included using this method:
JSON.stringify(cordova.require('cordova/plugin_list').metadata, null, 1)
but Emulator and Debugger keep using version 1.1.0
Then I build it from BUILD page in XDK and it works and shows using version 1.3.2. Problem Solved.
I'm sorry that I didn't try that before posting, but in my defence building every time, download it, then install it on device takes so much time, like 20 mins for each test and it's not very logical.
When I find out that XDK using default version of plugins in emulator, I decided to update plugins manually in XDK Folder in Windows:
%LOCALAPPDATA%\Intel\XDK\xdk\components\server\cordova-plugins
I just removed org.apache.cordova.file
folder and got new clone from https://github.com/apache/cordova-plugin-file
to make my tests in Emulator with updated version.
Just update plugins in this folder in Windows:
%LOCALAPPDATA%\Intel\XDK\xdk\brackets\b\extensions\default\StaticServer\node\node_modules\cp\res\middleware\cordova\intel-app-preview\android\plugins
and Debugger works well with updated plugins.
Clone from git like this in each folder:
In folder org.apache.cordova.file
git init && git remote add origin https://github.com/apache/cordova-plugin-file.git && git pull
now you have all versions in git.
For updating all plugins you can just run this bash command in plugin root directory: (in Windows use Git Bash)
for i in $(find $PWD -maxdepth 1 -type d); do echo $i && cd $i && git pull; done