MZ [Resolved] Creating a Txt File in a Deployed Project Folder

I'm working on a game that makes use of writing txt files to the project folder. Using the solution in this thread, I was able to get them successfully written to the project file in the RPG Maker MZ editor. Although, when I deploy my project file as an .exe, I noticed it doesn't work and won't write the .txt file to that project file. I'm running it on my main hard drive where I have full write permission, so I'm wondering if maybe there's just a better solution geared towards deployed projects that I'm unaware of.

This is the code I have currently:
const path = require('path');
const base = path.dirname(process.mainModule.filename);
const fs = require('fs');
const fileText = "Output text here!";
fs.writeFileSync(base + 'extra_folder\\intro.txt', fileText);

Is there a better way to do this that would allow it to work in an exported version of the game/outside of RPG Maker?

Edit: I ended up actually resolving this after digging further into this! It was just how I had the subfolders set up, so this was all I needed to change it to:

fs.writeFileSync(base + '/extra_folder/intro.txt', fileText);

Hopefully this is helpful to someone else who might've also run into this issue!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/resolved-creating-a-txt-file-in-a-deployed-project-folder.176435/