Guest User

Untitled

a guest
Jul 31st, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. -------------------------
  2.  
  3. function widget:GetInfo()
  4. return {
  5. name = "Compress Test",
  6. desc = "Test for compress folder",
  7. author = "gajop",
  8. date = "in the future",
  9. license = "GPL-v2",
  10. layer = 1001,
  11. enabled = true,
  12. }
  13. end
  14.  
  15. function doIt()
  16. local temp_dir = "_compressfolder_temp_dir"
  17. Spring.CreateDir(temp_dir)
  18.  
  19. local f = assert(io.open(temp_dir .. "/example_file.txt", "wb"))
  20. local text = "Hello World"
  21. f:write(text)
  22. assert(f:close())
  23.  
  24. VFS.CompressFolder(temp_dir, "zip", "example.zip")
  25. os.remove(temp_dir)
  26. end
  27.  
  28. function widget:Initialize()
  29. success, errMsg = pcall(doIt)
  30. if not success then
  31. Spring.Echo(errMsg)
  32. end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment