Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
mahusa7
Level 7

Changing permissions of file in temp

I am copying a file to temp from package, and want to write to it. However, the permissions of the file turn out read only. Is there a way to change the permissions?

print fileSystem.Stat("tmp:/Untitled.m3u8") gives:

<Component: roAssociativeArray> =
{
    ctime: <Component: roDateTime>
    hidden: false
    mtime: <Component: roDateTime>
    permissions: "r"
    size: 858
    type: "file"
}

Any suggestions or workarounds would be appreciated.
        
0 Kudos
7 Replies
tim_beynart
Level 7

Re: Changing permissions of file in temp

did you try setting the permissions on the file to 777 before you deploy the app?
0 Kudos
mahusa7
Level 7

Re: Changing permissions of file in temp

I did. It seems that any file read from package becomes read only. I found a workaround for this by downloading the file to tmp from a server.
0 Kudos
Roku Employee
Roku Employee

Re: Changing permissions of file in temp

Said m3u8 is a small text file, right?
ReadAsciiFile()/WriteAsciiFile()
0 Kudos
mahusa7
Level 7

Re: Changing permissions of file in temp

WriteAsciiFile does not work as the file is read only when read from pkg.
0 Kudos
Roku Employee
Roku Employee

Re: Changing permissions of file in temp

"mahusa7" wrote:
WriteAsciiFile does not work as the file is read only when read from pkg.

And if you try this?
text_content = ReadAsciiFile("pkg:/my.m3u8")
' massage text_content to your heart`s content here
' ...
WriteAsciiFile("tmp:/my.m3u8", text_content)
0 Kudos
destruk
Level 10

Re: Changing permissions of file in temp

That should work RokuNB, as it's writing it to tmp Smiley Happy
0 Kudos
mahusa7
Level 7

Re: Changing permissions of file in temp

That does work. Thank you. Smiley Happy
0 Kudos