views:

43

answers:

1

Hi there, I want to save data to my Sony Ericsson K750i. I know the phone implements FileConnection version 1.0. The list of roots taken from

FileSystemRegistry.listRoots();

returns single element named "c:/". I want to save a file.txt just about anywhere, but preferably to the memory stick attached. Unfortunately, it doesn't seem to work. It throws an IOException without any message. I tried opening the fileconnection on numerous roots like c:/, C:/, /, ./, root1/, SDCard/, CFCard/, MemoryStick/ and perhaps some more but without any luck.

The exception is thrown right after this line for any of those roots:

FileConnection filecon = (FileConnection) Connector.open("file:///MemoryStick/file.txt");

Please, what URL should i use?

A: 

I would suspect that your problem is that you are trying to write a file in a location your MIDlet isn't allowed to write to.

My guess is that you can read "c:/" just enough to figure out what its subfolders are. You can't create a file or a subfolder.

However, browse through c: subfolders and there should be a location somewhere where you can create a subfolder and/or a file.

Of course, all this assumes that your MIDlet is signed with a certificate that puts it in a security domain allowing good enough file system access.

QuickRecipesOnSymbianOS
I have already figured it out. What you are saying is true. I could have used open("file:///MemoryStick/) instead of direct opening file. The problem with accessing MemoryStick was because of usb connection to the computer, which was blocking the MemoryStick root for the phone. Certificates is a pain, but good phones (like this one) allow you to manage permissions.
Trimack