Returns the absolute file path of the specified file.
$m.getFilePath("offline_orders.txt", function(response) { var message; if(response.code == -1) { // External storage is not ready. Possible reason could be the storage // is mounted to file system on a computer. return; } if(response.result) { message = "File path is " + response.result; } else { message = "Error - " + response.error.message; } }); |
Syntax
$m.getFilePath(filePath[, fp_callback])
$m.getFilePath(file[, fp_callback])
Parameters
filePath
string (required)
The path of the file relative to the pack folder.
file
file (required)
The mowbly file object. Use getFile method to create the mowbly file object. The advantage of using file over filePath parameter is that file object provides options to specify the path relative to the application folder or storage root apart from pack.
fp_callback
function (optional)
Function that is invoked when the file path is read. The function receives a response object as parameter with the following properties,
- code - {Number}. Possible codes are,
- -1 - Storage is not ready.
- 1 - File path is successfully read.
- 0 - Error in reading file path.
- result - {String}. The absolute path of the file.
- error - {Object}. Available when the code is 0. The error object contains,
- message - {String}. A short description of the error.
- description - {String}. A detailed description of the error.