The plugin saves everything on the branch with the name it is named in the adding plugins section.
By default, this is the name of the project/plugin given in the project/plugin settings section when it was created.
When you add a plugin to your project, you can see the name in the plugin section (plus on the left, at the very bottom of the list),
and you can also change it .
By changing the name, you change the branch on which files will be added.
The plugin only has access to this branch. Only there he can add and delete files - this is probably for security reasons. Imagine that you install a plugin, run it and your entire project is deleted.
Edit
You can read files from the host project.
You cannot save and delete from branches other than the plugin name.
system.project.listFiles( "sprites",
function( list, error)
list.forEach( function( name, index )
print(name)
end)
end)
Edit 2
It says in the documentation:
Note: when used as a plug-in, your app file access will be restricted by default to a subfolder of the host project.
init = function()
files = system.project.listFiles( "sprites",
function( list, error)
list.forEach( function( name, index )
print(name)
end)
end)
end
update = function()
end
draw = function()
screen.clear()
if files.ready then
local index = screen.height / 2 - 20
for file in files.list
screen.drawText( "file: " + file.name, 0, index, 20, "red")
index -= 20
end
if files.list.length == 0 then
screen.drawText("Zero files.", 0, 0, 20, "red")
end
else
screen.drawText(" No file", 0, 0, 20, "red")
end
end
I thought right the first time.
I changed my mind because I accidentally ran the plugin like a normal application and not in the host project.
There is no access to host files from the plugin.