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

Java Development

Reply
Developer
lucidbee
Posts: 86
Registered: ‎07-21-2009
My Device: Not Specified
Accepted Solution

clean doesn't clean

I'm using the 1.1 eclipse plugin and the 8520 simulator with the 5.0 api.

 

My app saves a file called DATA.txt and I am trying to get rid of it.

I have tried clean.bat - it's still there.

I have tried the eclipse clean - it's still there.

 

I know it's there because the I open it in my app and read some init parameters, which are

bad - so I want to re-initialize this file. But i can't because I can't delete it.

 

Where is the file on the pc?

What is going on here?

thanks !

lucidbee

Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: clean doesn't clean

What is the full path to the file in your application?

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
lucidbee
Posts: 86
Registered: ‎07-21-2009
My Device: Not Specified

Re: clean doesn't clean

file:///store/home/user/DATA.txt

 

thanks.

lucicbee

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: clean doesn't clean

[ Edited ]

AFAIK, clean.bat does not reset the SD Card or internal SD Card.  It's job is to reset the applications on the handheld.

 

I am not aware of anything that automatically keeps a track of which files on SD Card or internal 'card' and removes these if/when the creating application is removed.

 

So I think if you want a new file, you are going to have to remove it manually, or have some function in your application that will clear it.

Contributor
bigfoot
Posts: 48
Registered: ‎02-19-2011
My Device: Not Specified

Re: clean doesn't clean

I cut and pasted this example from the API docs for the FileConnection class.  It tells you how to create (and delete) a file. 

 

.... the following code can be used to create a new file on a file system, where CFCard is a valid existing file system root name for a given implementation:

 try {
FileConnection fconn = (FileConnection)Connector.open("file:///CFCard/newfile.txt");
// If no exception is thrown, then the URI is valid, but the file may or may not exist.
if (!fconn.exists())
fconn.create(); // create the file if it doesn't exist

fconn.close();
}
catch (IOException ioe) {
}

Developers should always check for the file's or directory's existence after a connection is established to determine if the file or directory actually exists. Similarly, files or directories can be deleted using the FileConnection.delete() method, and developers should close the connection immediately after deletion to prevent exceptions from accessing a connection to a non-existent file or directory.

Contributor
bigfoot
Posts: 48
Registered: ‎02-19-2011
My Device: Not Specified

Re: clean doesn't clean

By the way, sometimes it helps to change the project configuration.  I am using Eclipse.  To be able to find a file in my Windows file system I had to change the debug configuration to turn on the "Use PC file system for SD Cards" option.  Don't think that will work in your case though because you are not using a SD card.

Developer
lucidbee
Posts: 86
Registered: ‎07-21-2009
My Device: Not Specified

Re: clean doesn't clean

So I used fconn.delete() and deleted the trashed file. Then I removed the fconn.delete() from the code.

 

Seems odd to delete files this way  but whatever works!

 

thanks,

lucidbee