[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

obsolete[LuaStudio] startup.lua

--doU8File.lua
doU8File = function(localPath,httpURL)
	local platform = Lib.Media.System.systemName()
	if platform == "ios" or patform == "android"
		then root = Lib.Media.FileSystem.File.documentsDirectory.nativePath .. "/"
		else root = "/"
	end
	local path = root..localPath
	
	-- check if m8n base is present
	if Lib.Sys.FileSystem.exists(path)
		then dofile(path)
		else
		-- m8n base is not present, download from URL and save to local
		local data = Lib.Sys.Net.Http.requestUrl(httpURL..localPath)		
		local fileName = path:find("/[^/]*$")
		local dir = string.gsub(path, path:sub(fileName), "")
		Lib.Sys.FileSystem.createDirectory(dir)
		Lib.Sys.IO.File.saveContent(path, data)
		dofile(path)
	end
end

doAllU8Files = function()
	doU8File("m8n/s8.snapshot.lua","http://u8.smalltalking.net/u8/profile/aleReimondo/")
	doU8File("m8n/LuaStudio/LuaStudio.st.lua","http://u8.smalltalking.net/u8/profile/aleReimondo/")
	doU8File("m8n/LuaStudio/LuaStudioSamples.st.lua","http://u8.smalltalking.net/u8/profile/aleReimondo/")
	--doU8File("swiki/swiki.st.lua","http://u8.smalltalking.net/u8/profile/aleReimondo/")
	--doU8File("swiki/swikiStudio.st.lua","http://u8.smalltalking.net/u8/profile/aleReimondo/")
end

doAllU8Files()

load(Lib.Sys.Net.Http.requestUrl("http://u8.smalltalking.net/u8/profile/felipe.zak/556/sample.st.lua"))()