libsaria: Remove old file management code
I have new code for loading / saving objects, so I can remove the old stuff.
This commit is contained in:
parent
5199a26006
commit
063869c7ca
|
@ -2,7 +2,6 @@
|
|||
|
||||
import libsaria
|
||||
from libsaria import path
|
||||
import cPickle as pickle
|
||||
plugin = None
|
||||
export = None
|
||||
|
||||
|
@ -10,31 +9,6 @@ dev = ""
|
|||
if libsaria.__dev__ == True:
|
||||
dev = "-dev"
|
||||
|
||||
PROTO = pickle.HIGHEST_PROTOCOL
|
||||
|
||||
def save(item, file, ext=".pickle"):
|
||||
file = "%s%s%s" % (path.join(path.saria_dir(),file), dev, ext)
|
||||
savefile(item, file)
|
||||
|
||||
def savefile(item, file):
|
||||
f = open(file, 'w')
|
||||
p = pickle.Pickler(f, PROTO)
|
||||
p.dump(item)
|
||||
f.close()
|
||||
|
||||
def load(file, ext=".pickle"):
|
||||
file = "%s%s%s" % (path.join(path.saria_dir(),file), dev, ext)
|
||||
return loadfile(file)
|
||||
|
||||
def loadfile(file):
|
||||
if path.exists(file) == False:
|
||||
return
|
||||
f = open(file)
|
||||
data = f.read()
|
||||
item = pickle.loads(data)
|
||||
f.close()
|
||||
return item
|
||||
|
||||
def open_plugin(file):
|
||||
global plugin
|
||||
if plugin == None:
|
||||
|
|
Loading…
Reference in New Issue