When running in Node-Webkit, hold onto the full savePath when opening.piskel files via the gui or drag and drop.

This commit is contained in:
Lee Grey
2015-03-22 00:39:23 +13:00
parent 6a6f75b3ce
commit c9b581f6db
3 changed files with 15 additions and 5 deletions

View File

@@ -13,7 +13,18 @@
loadFromFile : function (file, onSuccess, onError) {
pskl.utils.FileUtils.readFile(file, function (content) {
var rawPiskel = pskl.utils.Base64.toText(content);
ns.PiskelFileUtils.decodePiskelFile(rawPiskel, onSuccess, onError);
ns.PiskelFileUtils.decodePiskelFile(
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, descriptor, fps);
},
onError
);
});
},