Electron app is not creating folder such as "upload" when it start with auto-launch?


#1
  1. I have install the npm auto-launch in my application.
  2. Packaged my Electron application.
  3. Make installation for windows.
    Then when i tried to run with the App.exe it fires the addEventListener but when the Electron program is run with auto-launch then addEventListener is not fired. Can’t find the reason that why its behaving this way? Can anyone help me?
    My code:

function gotStream(stream) {
alert(“Now in the gotStream”);
var randomnumber = Math.floor(Math.random()*1000);

        var video = document.createElement('video');
        video.addEventListener('loadedmetadata', function () {

            alert("Now in the video addEventListener");
             if(!fs.existsSync(dir))
           {
               alert("Inside fs.exist fs");
               fs.mkdirSync(dir)
           }

           else
           {

               //alert("canot make");
           }
            
            alert("before fs writeFile");
            fs.writeFile('uploads/image'+datetime + randomnumber+ dot + ext, data1, 'base64', function (err) {
                 alert("Now in the fs writfile");
                if (err) {
                    alert("An error ocurred creating the file " + err.message)
                } 
             });
          }, false);
       video.src = URL.createObjectURL(stream);
       video.play();

}