Integrate & adapt selectFiles function
Issue #31
resolved
Based on this by @rafikhan, adapted from something by @rendertom
Needs to be aequery-ified, and implemented as aeq.file.selectFiles();
var myFiles = selectFiles(["jsx", "theme", "someOtherExtension"], true);
function selectFiles(extensionList, multiSelect)
{
var message = multiSelect ? "Please select multiple files" : "Please select file";
var getFilterForFiles = function ()
{
var isWindows = ($.os.indexOf("Windows") != -1);
if (isWindows) {
return '*.' + extensionList.join(';*.');
} else {
var extensionListRe = '\.(' + extensionList.join('|') + ')$';
var re = new RegExp(extensionListRe, "i");
return function (file) {
return file.name.match(re) || file.constructor.name === "Folder";
};
}
}
return File.openDialog(message, getFilterForFiles(), multiSelect);
}
Comments (2)
-
-
Account Deleted reporter - changed status to resolved
Adds selectFiles to aeq.file (resolve
#31)→ <<cset 4c31af03dc1e>>
- Log in to comment
Add third optional 'message' parameter to the function, so you can prompt for custom message when dialog appears.