[OutSystems Now] DeviceFeatures\SaveFile webblock: how to save file in a different directory?
Forge component by OutSystems R&D

When using DeviceFeatures\SaveFile webblock, if I include a directory path in the Filename input parameter (e.g. "outsystems-now-test/log.txt"), it won't work and I get an INVALID_MODIFICATION_ERR message, such as the one below:


Probably some error in trying to modify the device's filesystem (this is Android, by the way).
Any ideas on how to overcome this?
Will further digging into the Apache Cordova API be needed?

Hello Pedro.

The way that the SaveFile WebBlock is implemented won’t allow you to provide that kind of paths. It just expects the Filename. To achieve what you want you’ll have to change the SaveFile javascript to use more sophisticated logic. One example is using the resolveLocalFileSystemURL
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, function(dir) { });
For more examples you’ll have to take a closer look at the Cordova File Plugin – Where To Store Files
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.