Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mahusa7
Visitor

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 7
tim_beynart
Channel Surfer

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
Visitor

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
RokuNB
Roku Guru

Re: Changing permissions of file in temp

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

Re: Changing permissions of file in temp

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

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
Binge Watcher

Re: Changing permissions of file in temp

That should work RokuNB, as it's writing it to tmp 🙂
0 Kudos
mahusa7
Visitor

Re: Changing permissions of file in temp

That does work. Thank you. 🙂
0 Kudos