mob/verb
create_savefiles()
var/savefile
savefile_1 = new("savefile_1.sav")
savefile_2 = new("savefile_2.sav")
savefile_3 = new("savefile_3.sav")
savefile_1["document"] << "Some text."
savefile_2["document"] << "More text."
savefile_3["document"] << "Much text."
compress_savefiles()
// Create a new zipfile called "savefiles.zip"
var/zipfile/zipfile = new("./savefiles.zip")
// Import all the savefiles that were created in \
create_savefiles() to my new zipfile.
zipfile.Import("savefile_1.sav","savefile1.sav")
zipfile.Import("savefile_2.sav","savefile2.sav")
zipfile.Import("savefile_3.sav","savefile3.sav")
// It's important to note that zipfile.Import() doesn't \
move the file, it copies it. So I delete the savefiles.
fdel("savefile_1.sav")
fdel("savefile_2.sav")
fdel("savefile_3.sav")
// Close the zipfile. This is important!
zipfile.Close()
read_zipfile_contents()
var/zipfile/zipfile = new("./savefiles.zip")
// Read the contents of savefiles.zip and \
display them.
for(var/file in zipfile.Flist())
usr << file
zipfile.Close()
decompress_savefiles()
var/zipfile/zipfile = new("./savefiles.zip")
// Export all the savefiles from savefiles.zip.
for(var/file in zipfile.Flist())
// @Todo: Export file.
zipfile.Close()
Problem description: The problem with this code is that savefiles imported to the zipfile are put in the end of some weird complex of folders which I have no idea on how they could get there. This is the zipfile I get:
savefiles.zip/
Documents and Settings/
Administrator/
Desktop/
Secret experiment 69/ (this is the project's name)
savefile1.sav
savefile2.sav
savefile3.sav
But the expected result is:
savefiles.zip/
savefile1.sav
savefile2.sav
savefile3.sav
Help please!
var/zipfile/zipfile = new("./savefiles.zip")
Instead of this:
var/zipfile/zipfile = new("savefiles.zip")
This is where I would start; I wonder if it changes anything?