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

obsolete[LuaStudio] Load m8n base

--doU8File.lua
doU8File = function(localPath,httpURL)
	local platform = Lib.Media.System.systemName()
	if platform == "ios" or platform == "android"
		then root = Lib.Media.FileSystem.File.documentsDirectory.nativePath .. "/"
		else root = "/"
	end
	local path = root..localPath
	
	-- check if m8n base is present
	if not Lib.Sys.FileSystem.exists(path)
		then
		-- 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)
	end
	dofile(path)
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()