Forum Discussion

mahusa7's avatar
mahusa7
Visitor
8 years ago

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.
        

7 Replies

  • did you try setting the permissions on the file to 777 before you deploy the app?
  • 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.
  • Said m3u8 is a small text file, right?
    ReadAsciiFile()/WriteAsciiFile()
  • WriteAsciiFile does not work as the file is read only when read from pkg.
  • "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)
  • destruk's avatar
    destruk
    Streaming Star
    That should work RokuNB, as it's writing it to tmp 🙂