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

21
LINES

< > BotCompany Repo | #1027380 // cleanFluidTextFile

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (5764L) is out of date.

// returns true if file was changed
sbool cleanFluidTextFile(File f, O... _) {
  optPar bool withBackup = true;
  optPar bool verbose;
  new CleanFluidTextFile cleaner;
  cleaner.verbose = verbose;
  {
    temp Reader reader = utf8reader(f);
    cleaner.reader = reader;
    cleaner.read();
  }
  new StringWriter writer;
  cleaner.writer = writer;
  cleaner.write();
  S out = str(writer);
  if (eq(loadTextFile(f), out)) false;
  if (withBackup)
    print("Backed file up to " + renameFileToSomeBackupName(f, "fluidClean"));
  saveTextFile(f, out);
  true;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027380
Snippet name: cleanFluidTextFile
Eternal ID of this version: #1027380/8
Text MD5: bb8c727e1ea2c0ae7648128f873c630d
Author: stefan
Category: javax / fluid text files
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-15 17:06:53
Source code size: 580 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 204 / 300
Version history: 7 change(s)
Referenced in: [show references]