• What's in Storage.list()? Is it possible the file is called something other than "fitclock.log"?

  • Sorry, didn't see this reply earlier (I didn't refresh the page oops). No, the filename is correct. To verify the glitch, have a Bangle watch with bare minimum apps (Bootloader + Default Launcher + Battery Widget + Morph Clock App). Now run the following code (same as above without the erase all and dummy sync)

    function repro() {
      
      for(var i = 0; i < 1; i++){
        print("Writing test file, attempt " + (i+1));
        var file = require("Storage").open("testfile.log", "a");
        try
        {
          while (true){
            var sentence = "Long string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberishLong string of gibberish\n";
            file.write(sentence);
          }
        }
        catch(ex){
          console.log(ex);
          console.log("File size after write error: " + file.getLength().toString());
          file = null;
        }
        
        print("Files before Erase " + (i+1) + "\n" + JSON.stringify(require("Storage").list()­));
        print("Storage.getFree Before Erase " + (i+1) + " " + require("Storage").getFree().toString())­;
        require("Storage").open("testfile.log", "w").erase();
        require("Storage").compact();
        print("Storage.getFree After Erase and compact " + (i+1) + " " + require("Storage").getFree().toString())­;
        print("Files after Erase " + (i+1) + "\n" + JSON.stringify(require("Storage").list()­));
      }
    }
    repro();
    
    

    You will see getFree before and after erase doesn't make a difference even though the testfile.log file gets removed from the list().

About

Avatar for PiOfThings @PiOfThings started