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: 

Component Library Local File Access

It seems that when I try to read the Component Library local file system with pkg: or libpkg: using file system object I get nothing. I was reading that the older SDK had a way to set read permissions for the library components from the main app? Is this gone now? Thanks!

0 Kudos
7 REPLIES 7
Chris-DP
Binge Watcher

Re: Component Library Local File Access

You need to use libpkg: and the global utility functions starting here: https://developer.roku.com/en-ca/docs/references/brightscript/language/global-utility-functions.md#l...

roFileSystem won’t work. 

0 Kudos
slingxshot
Streaming Star

Re: Component Library Local File Access

It seems global Utility CopyFile is not working when trying to copy files from pkg to tmp. Nothing happens. Is this on purpose? 

Also I don't seem have to have a way to access Component Library file system from the main app? 

 

Thanks

0 Kudos
Chris-DP
Binge Watcher

Re: Component Library Local File Access

The component library and app are sandboxed from each other. This is why you can’t copy to tmp. 

0 Kudos
slingxshot
Streaming Star

Re: Component Library Local File Access

What is interesting is that Copying file from one location to another within pkg doesn't work. Does Roku document these permissions? 

Thanks!

0 Kudos
Chris-DP
Binge Watcher

Re: Component Library Local File Access

They do not. Their documentation around component libraries is very limited. If your goal is to have a file in the library and get it in your own pkg code you are going to need to create a component in the library that can read the contents and return them to your pkg. then your pkg can write them to disk. 

Component libraries are not designed to be a download anything solution. They are intended for you to be able to download custom SceneGraph components. Thus the name.   

0 Kudos
slingxshot
Streaming Star

Re: Component Library Local File Access

They used to. It is like they went backwards. Here is the text from their blog post in 2015.

Registry Permissions

Roku provides a mechanism for managing permissions for registry keys. An application can specify that a given registry key should have read and/or write permissions granted to one or more other applications or components.

To manage registry permissions, an application should follow these steps:

  1. Create an instance of the roRegistry object.
  2. Call the grantPermission() method on the roRegistry object to grant a permission to a registry key. The grantPermission() method takes two arguments: the permission name (either "read" or "write"), and the name of the registry key that should have the permission granted. The registry key name should be specified in the format "pkg:/path/to/key".
  3. To revoke a permission, call the revokePermission() method on the roRegistry object. The revokePermission() method takes the same two arguments as the grantPermission() method.

Note that permissions are granted on a per-application basis. To grant a permission to a component library, you should grant the permission to the package ID of the library (which can be obtained using the pkgId field of the roAssociativeArray returned by the GetManifest() method of the component library).

0 Kudos
Chris-DP
Binge Watcher

Re: Component Library Local File Access

The post is only talking about registry. It doesn’t talk about the file system at all. Also I’m not sure this is even an issue anymore at least with registry access. 

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.