liran
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2011
02:58 AM
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
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
5 REPLIES 5

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2011
08:51 AM
Re: Write to USB file
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
--Mark
liran
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2011
11:03 PM
Re: Write to USB file
Thanks, I'll try it.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2012
06:34 PM
Re: Write to USB file
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.
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.
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2012
08:29 PM
Re: Write to USB file
From the documentation: "The USB filesystems are currently mounted read only."
-JT
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2012
10:11 PM
Re: Write to USB file
"renojim" wrote:Thanks, could have read that myself huh.
From the documentation: "The USB filesystems are currently mounted read only."
-JT
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.