Do not crash when importing non-utf8 .txt files
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
|
||||
let import_txt = function(path, done) {
|
||||
iron.Data.getBlob(path, function(b) {
|
||||
var filename = path.split('\\').pop().split('/').pop();
|
||||
arm.UIBox.showMessage(filename, b.toString(), true);
|
||||
arm.UIBox.clickToHide = false;
|
||||
iron.Data.deleteBlob(path);
|
||||
});
|
||||
}
|
||||
|
||||
let plugin = new arm.Plugin();
|
||||
let formats = arm.Path.textureFormats;
|
||||
let importers = arm.Path.textureImporters;
|
||||
formats.push("txt");
|
||||
importers.h["txt"] = import_txt;
|
||||
|
||||
plugin.delete = function() {
|
||||
formats.splice(formats.indexOf("txt"), 1);
|
||||
importers.h["txt"] = null;
|
||||
};
|
||||
@@ -2,9 +2,14 @@
|
||||
let import_txt = function(path, done) {
|
||||
iron.Data.getBlob(path, function(b) {
|
||||
var filename = path.split('\\').pop().split('/').pop();
|
||||
arm.UIBox.showMessage(filename, b.toString(), true);
|
||||
arm.UIBox.clickToHide = false;
|
||||
iron.Data.deleteBlob(path);
|
||||
try {
|
||||
arm.UIBox.showMessage(filename, b.toString(), true);
|
||||
arm.UIBox.clickToHide = false;
|
||||
iron.Data.deleteBlob(path);
|
||||
}
|
||||
catch(e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ project.addShaders("Shaders/*.glsl", { embed: flags.snapshot });
|
||||
project.addAssets("Assets/*", { destination: "data/{name}", embed: flags.snapshot });
|
||||
project.addAssets("Assets/locale/*", { destination: "data/locale/{name}" });
|
||||
project.addAssets("Assets/licenses/**", { destination: "data/licenses/{name}" });
|
||||
project.addAssets("Assets/plugins/*", { destination: "data/plugins/{name}" });
|
||||
project.addAssets("Assets/themes/*.json", { destination: "data/themes/{name}" });
|
||||
|
||||
if (flags.snapshot) {
|
||||
|
||||
Reference in New Issue
Block a user