exports.getPrefixFromFile = getPrefixFromFile;
function addModInfo(modDir) {
let config = armadev_1.ArmaDev.Self.Config;
let destPath = path.join(modDir, 'mod.cpp');
let data = '';
data += 'name = "' + config.title + ' v' + config.version + '";\n';
data += 'author = "' + config.author + '";\n';
if (config.website) {
data += 'actionName = "Website";\n';
data += 'action = "' + config.website + '";\n';
}
logger.logDebug('Data: ' + data);
logger.logDebug('mod.cpp file location: ' + destPath);
fs.writeFile(destPath, data, (err)=>{logger.logError(err)});
logger.logDebug('Finished writing to mod.cpp');
}
I added some additional logging in this function to troubleshoot the issue. Not really needed, but it was a helpful checkpoint. When attempting to build the client mod, I would get a generic callback error. After tracing down the issue, I found that fs.writeFile(destPath, data) was not working. I'm not a java dev, but it seems similar to System.IO.File.WriteAllText in c#, so could be an issue with the java library itself. Anyway, after adding the callback function, the mod wrote mod.cpp as expected.
This issue was resolved at some point last year. I apologize for disappearing after the last PR. I see some additional logging was added as well. Marked this case as closed to keep things tidy.
Suggest adding callback to fs.writeFile function:
Original: fs.writeFile(destPath, data); Suggested: fs.writeFile(destPath, data, (err)=>{logger.logError(err)});
I added some additional logging in this function to troubleshoot the issue. Not really needed, but it was a helpful checkpoint. When attempting to build the client mod, I would get a generic callback error. After tracing down the issue, I found that fs.writeFile(destPath, data) was not working. I'm not a java dev, but it seems similar to System.IO.File.WriteAllText in c#, so could be an issue with the java library itself. Anyway, after adding the callback function, the mod wrote mod.cpp as expected.
10 - Would also help with these generic errors.