Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1001340 // zipBot

JavaX fragment (include)

static int zipBot_compressionLevel = 9; // highest!

// returns true if actual zip file (not empty)
static boolean zipBot(S botToZip, File destZip) ctex {
  File dir = getProgramDir(botToZip);
  
  mkdirsForFile(destZip);
  FileOutputStream fout = new FileOutputStream(destZip);
  ZipOutputStream zout = new ZipOutputStream(fout);
  zout.setLevel(zipBot_compressionLevel);
  int count = 0;
  if (dir.isDirectory())
    count += dir2zip(dir, zout, "JavaX-Data/" + botToZip + "/");
  if (count == 0) {
    print("Nothing to zip for bot " + botToZip);
    fout.close();
    return false;
  } else {
    zout.close();
    print("Zipped " + botToZip + " (" + count + " entries) to " + destZip.getAbsolutePath() + " (" + destZip.length() + " bytes)");
    return true;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001340
Snippet name: zipBot
Eternal ID of this version: #1001340/1
Text MD5: c9773d99cdc0e9fa565c39be3c37dbb1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-17 14:39:25
Source code size: 790 bytes / 23 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 779 / 1007
Referenced in: #1002427 - Accellerating 629 (SPIKE)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#3000202 - Answer for stefanreich (>> T conversion bot)
#3000238 - Answer for stefanreich (>> t power bot)
#3000382 - Answer for ferdie (>> t = 1, f = 0)