mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fix regression when loading piskel files
This commit is contained in:
parent
4a01f5625c
commit
440c28d0fd
@ -11,26 +11,32 @@
|
||||
* @param {Function} onError NOT USED YET
|
||||
*/
|
||||
loadFromFile : function (file, onSuccess, onError) {
|
||||
pskl.utils.FileUtils.readFileAsArrayBuffer(file, function (content) {
|
||||
pskl.utils.FileUtils.readFile(file, function (content) {
|
||||
var rawPiskel = pskl.utils.Base64.toText(content);
|
||||
ns.PiskelFileUtils.decodePiskelFile(
|
||||
content,
|
||||
function (piskel, extra) {
|
||||
rawPiskel,
|
||||
function (piskel, descriptor, fps) {
|
||||
// if using Node-Webkit, store the savePath on load
|
||||
// Note: the 'path' property is unique to Node-Webkit, and holds the full path
|
||||
if (pskl.utils.Environment.detectNodeWebkit()) {
|
||||
piskel.savePath = file.path;
|
||||
}
|
||||
onSuccess(piskel, extra);
|
||||
onSuccess(piskel, descriptor, fps);
|
||||
},
|
||||
onError
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
decodePiskelFile : function (serializedPiskel, onSuccess, onError) {
|
||||
pskl.utils.serialization.Deserializer.deserialize(serializedPiskel, function (piskel, extra) {
|
||||
onSuccess(piskel, extra);
|
||||
decodePiskelFile : function (rawPiskel, onSuccess, onError) {
|
||||
var serializedPiskel = JSON.parse(rawPiskel);
|
||||
var fps = serializedPiskel.piskel.fps;
|
||||
var piskel = serializedPiskel.piskel;
|
||||
var descriptor = new pskl.model.piskel.Descriptor(piskel.name, piskel.description, true);
|
||||
pskl.utils.serialization.Deserializer.deserialize(serializedPiskel, function (piskel) {
|
||||
onSuccess(piskel, descriptor, fps);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
})();
|
||||
})();
|
Loading…
Reference in New Issue
Block a user