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

32
LINES

< > BotCompany Repo | #1018960 // JavaX Directory Sizes [Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (15423L/108K).

!7

sclass DirInfo {
  File file;
  long size;
}

module JavaXDirSizes extends DynObjectTable<DirInfo> {
  start {
    itemToMap = func(DirInfo d) -> Map {
      litorderedmap(
        Directory := f2s(d.file),
        "Size" := str_toM_questionMarkIfBelowZero(d.size))
    };
    
    // wait 10 seconds if booting, then every 10 minutes
    doEvery(dm_osStarting() ? 10.0 : 0.0, 600.0, r calcIt);
  }
  
  void calcIt {
    temp enter();
    new L<DirInfo> l;
    time "Calculate Dir Sizes" {
      for (File dir : allJavaXDirectories()) {
        long size = -1;
        pcall { size = guessClusteredDirSize(dir); }
        l.add(nu(DirInfo, file := dir, +size));
      }
    }
    setData(sortedByFieldDesc('size, l));
  }
}

Author comment

Began life as a copy of #1018937

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018960
Snippet name: JavaX Directory Sizes [Dyn Module]
Eternal ID of this version: #1018960/5
Text MD5: ceecd8f07ee9760c2109845dac22299e
Transpilation MD5: fef7a88950eddab9c2aaa04635280ca1
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-18 14:03:28
Source code size: 759 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 340 / 1309
Version history: 4 change(s)
Referenced in: [show references]