Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Dowload file from github — Gideros Forum

Dowload file from github

rrraptorrrraptor Member
edited November 2019 in General questions
I wonder, is there a way to download a file from github AND make it as part of the current project, so I can use "require" to use it?

I was trying this method:
url: https://raw.githubusercontent.com/MultiPain/Gideros_SuperShape/master/SuperShape.lua
local url = "" -- forum convert urls to html <a> tag : D
local loader = UrlLoader.new(url)
 
loader:addEventListener(Event.ERROR, function()
	print("Error loading file")
end)
 
loader:addEventListener(Event.PROGRESS, function(e)
	print("Loaded:",e.bytesLoaded,"Total:",e.bytesTotal)
end)
 
loader:addEventListener(Event.COMPLETE, function(e)
	local out, err = io.open("|R|SuperShape.lua", "w") --< write to %temp%\gideros\*Project name*\resource
	if (err) then 
		print(err) --< |R|SuperShape.lua: Permission denied
		return 
	end
	out:write(e.data)
	out:close()
end)

But its wrong way. I guess I just need to write file into assets folder where gproj located, but how can I get its pathh?)

Likes: Apollo14

+1 -1 (+1 / -0 )Share on Facebook

Comments

Sign In or Register to comment.