Discord
Login
Community
DARK THEME

system.project.deleteFile( "assets/generated/jsonfile", ... )

the delete function calls its callback to early, the file is not deleted when the callback is fired

when i delete a file and write the same file, then microstudio sees the not deleted file and creates a new file appending a number to the path provided

 system.project.deleteFile("assets/generated/jsonfile", () => {
    console.log("1 delete jsonfile");
    system.project.writeFile("assets/generated/jsonfile", { test: "me"}, { ext: "json" }, () => {
      console.log("2 write jsonfile");
    });
  });

  setTimeout(() => { 
    system.project.deleteFile("assets/generated/jsonfile", () => { 
       console.log("3 delete jsonfile again- this callback is tto early, file not deleted"); 
       system.project.writeFile("assets/generated/jsonfile", { test: "me again" }, { ext: "json" }, () => { 
         console.log("4 write jsonfile again"); 
       }); 
    }); 
  }, 
  1000);

what we get is a file called jsonfile2

I ran into the same problem, see Loginus's answer here.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community