Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 66
Registered: ‎09-14-2011
My Device: Simulator
My Carrier: Developer

saveFile working in one emulator and not working in another

In my application i'm converting data into json object and i'm writing those onto a file.

I wrote code in such a way that if tha filePath exists then dont do anything else create a file with default json object

i'm using this code

 

var fileLoginInfoPath = "file:///store/home/user/AppData/ClientLoginInfo.txt";
var loginInfo = [{RememberMe:"2",GroupId:"",Pin:""}];
    //if the file dosent exists, that means the user is using the application for 1st time so create file
  	var content = JSON.stringify(loginInfo);
	try {
      if (!blackberry.io.file.exists(fileCookiePath)) {
    	  var blob = blackberry.utils.stringToBlob(content, "UTF-8");
          blackberry.io.file.saveFile(fileLoginInfoPath, blob);
      }
    }
	catch (e) {
	    alert("error in creating loginInfo file:"+e);
	}

 

 this code is working perfectly when execued on "Bold 9770" emulator running on 5.0.0.469 os version

but same code is giving "net.rim.device.api.io.file.FileIOException:File Not Found" exception on "Strom2 9550" running on same os version ie., 5.0.0.469 and also it is giving same excetion when i tried running on "Torch 9800" running on 6.0.0.227 os version 

 

why is it like that??

 

Developer
Posts: 66
Registered: ‎09-14-2011
My Device: Simulator
My Carrier: Developer

Re: saveFile working in one emulator and not working in another

Anyone???
i'm still looking for the solution