Write to USB file

(I Saw this thread:
viewtopic.php?p=197784 )

I need to write a file on my app that will remain there on the next app runs.
From my understanding, I can write to ‘tmp’, but it will be deleted on the next run.
So my next, less wanted option is to write to a USB drive.
I put a USB, with FAT32, and with FAT format.
However, it failed to write to it. This is my code:

usbfile = “ext1:/usb.txt”
tempfile = “tmp:/temp4.txt”
success = WriteAsciiFile(tempfile,“writeusb2”)
print success ’ this is true
'copy from local to USB drive.
filesystem = CreateObject(“roFileSystem”)
success = filesystem.CopyFile(tempfile,usbfile) ’ this is false !!!
print success

Why is the last ‘success’ value false ?

Thanks

Using the USB for this purpose is not a very good solution. First, not all Roku devices have a USB port. Second, the user could remove the USB drive that you wrote to, or modify the file that you wrote. The Registry is a much better solution. It is designed to hold persistent application data. See roRegistry in the Component Reference.

–Mark

Thanks, I’ll try it.

So umm, why does filesystem.CopyFile(tempfile,usbfile) fail?

Is the file system mounted read-only or what?! Does it matter if it’s FAT, NTFS or?
You may assume i have legitimate use for read-write mount.

From the documentation: “The USB filesystems are currently mounted read only.”

-JT

“renojim” wrote:
From the documentation: “The USB filesystems are currently mounted read only.”
-JTThanks, could have read that myself huh.
Why are they still read-only if mounting was added in 2.6? I am guessing nobody wants to deal with flushing needed when dismounting (and esp the UI aspects of that)… crud.