ExtReMLapin

Untitled

Mar 12th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.07 KB | None | 0 0
  1. --[[
  2.  
  3. Dear Kurofeget,
  4. Someone forgot that into the leaked version of clockwork, so i hope you sales will discrease by 100%
  5. Now the save system is 100% working.
  6.  
  7. module link : http://www.solidfiles.com/d/f262e26a2f/
  8.  
  9.  
  10. (place this code in clockwork/framework/sv_cloudax.lua)
  11.  
  12. -Lapin
  13.  
  14.  ]]
  15.  
  16.  
  17. require("hio")
  18.  
  19. fileio = {}
  20.  
  21. local function checkFolder(path)
  22.     local t = string.Explode("/", path)
  23.     if table.Count(t) > 1 then
  24.         local p = t[1]
  25.         for i = 1, #t - 1 do
  26.             if !hIO.DirExists(p) then
  27.                 hIO.MakeDirectory(p)
  28.             end
  29.             p = p .. "/" .. t[i+1] or ""
  30.         end
  31.     end
  32. end
  33.  
  34. function fileio.Read(path)
  35.     checkFolder(path)
  36.     if hIO.FileExists(path) then
  37.         return hIO.Read(path)
  38.     else
  39.         return ""
  40.     end
  41. end
  42.  
  43. function fileio.Write(path, cont)
  44.     checkFolder(path)
  45.     hIO.Write(path, cont)
  46. end
  47.  
  48. function fileio.MakeDirectory(path)
  49.     checkFolder(path)
  50.     hIO.MakeDirectory(path)
  51. end
  52.  
  53. function fileio.Delete(path)
  54.     checkFolder(path)
  55.     hIO.Remove(path)
  56. end
  57.  
  58. function fileio.Append(path, cont)
  59.     checkFolder(path)
  60.     hIO.Write(path, fileio.Read(path) .. cont)
  61. end
Add Comment
Please, Sign In to add comment