summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
authorNathaniel Titterton <nate@berkeley.edu>2014-04-17 12:21:31 -0700
committerNathaniel Titterton <nate@berkeley.edu>2014-04-17 12:21:31 -0700
commit442265ba5f38aba57d8aea19c8c36ccfc6e39a26 (patch)
treed9d6ce7d9b141e3347576d999882b5f0097cb0ae /objects.js
parentce3340e623fd0f03ecb15de5ec54eda8113c7c67 (diff)
downloadsnap-yow-442265ba5f38aba57d8aea19c8c36ccfc6e39a26.tar.gz
snap-yow-442265ba5f38aba57d8aea19c8c36ccfc6e39a26.zip
give error message when attempting to import (into a variable) with a non-text file; don't read every file in multifile import
Diffstat (limited to 'objects.js')
-rw-r--r--objects.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/objects.js b/objects.js
index cc02ebe..fcb8796 100644
--- a/objects.js
+++ b/objects.js
@@ -6466,11 +6466,11 @@ WatcherMorph.prototype.userMenu = function () {
document.body.removeChild(inp);
ide.filePicker = null;
if (inp.files.length > 0) {
- for (i = 0; i < inp.files.length; i += 1) {
- file = inp.files[i];
- if (file.type.indexOf("text") === 0) {
- readText(file);
- }
+ file = inp.files[inp.files.length - 1];
+ if (file.type.indexOf("text") === 0) {
+ readText(file);
+ } else {
+ ide.inform("Unable to import", "Snap! can only import \"text\" files.\n You selected a file of type \"" + file.type + "\".");
}
}
},