MV RPGMakerMV Plugin doesn't work after deployment

Hello everyone!
Yesterday, we depolyed our project for testing purposes, as we have already noticed that the projects like to behave differently than in the test game and, for example, some plugins simply no longer work. Now we come to a problem that we find really exciting and unfortunately cannot find a solution. Apart from the Altimate Movement and Victor's battle system, we only have our own plugins.

Our overlay plugin works flawlessly in the test play. Everything is peachy! But in the deployed version it doesn't work at all. Even in an empty project where only the overlay plugin is in it, it only works in the test play. Unfortunately, we don't have any clue what else this could be because we can't debug properly anymore. If you edit plugins in packed versions, it doesn't always seem to notice all changes? Very confusing...

It would be a great help if someone knew about this and perhaps had a solution?

mkTqQvhB7lYogoqGdirpKac3Z.png


Greetings
MajinSonic
Hey,
I took a look at the code for you and as I expected it is because after you deployed the project the structure is a bit different. So when you try to load the folders using "CupHog_MapLayers.FileSystemAccess.readdirSync" its root is not in the "www" folder. So it cannot find the folder which is specified to be "img\someFolder" (which was the correct folder before deployment but now is "www\img\someFolder").

One solution could be by checking if you're play testing or not. If not then use "www" infront like so:
Code:
CupHog_MapLayers.FileSystemAccess.readdirSync((!Utils.isOptionValid('test') ? "www\\" : "") + INSERT_FOLDER_NAME);

EDIT:
Or to make it more robust make a function that ensures that you have the base/root folder attached:
Code:
CupHog_MapLayers.basePath = function(imageFolder) {
    var path = require('path');
    var base = path.dirname(process.mainModule.filename);
    return path.join(base, imageFolder);
}

This is how they already do it for the StorageManager to handle the local savefiles.

Then you have to use the function like this:
Code:
CupHog_MapLayers.FileSystemAccess.readdirSync(CupHog_MapLayers.basePath(INSERT_FOLDER_NAME));

Or just make a function that actually handles reading a directory:
Code:
CupHog_MapLayers.readDirectory = function(folder) {
    var path = require('path');
    var fs = require('fs');
    var dir = path.join(path.dirname(process.mainModule.filename), folder);;
    return fs.readdirSync(dir);
}

Used like this:
CupHog_MapLayers.readDirectory(INSERT_FOLDER_NAME);
Thank you very much! It worked 😀
Now we can use our Map Overlay again. (We also tweak some other plugins this way)

We also mentioned some performance issues (on some maps) in the deployed version... the whole rearrangement of the makers deployment is so... weird xD


You're added to our credit list 🙂
Moved to: Plugin Support

Original thread: https://forums.rpgmakerweb.com/threads/rpgmakermv-plugin-doesnt-work-after-deployment.133771/