mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
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:
parent
6a6f75b3ce
commit
c9b581f6db
@ -34,12 +34,12 @@
|
||||
|
||||
ns.DesktopStorageService.prototype.openPiskel = function () {
|
||||
pskl.utils.FileUtilsDesktop.chooseFileDialog(function(filename){
|
||||
var chosenFilename = filename;
|
||||
pskl.utils.FileUtilsDesktop.readFile(chosenFilename, function(content){
|
||||
var savePath = filename;
|
||||
pskl.utils.FileUtilsDesktop.readFile(savePath, function(content){
|
||||
pskl.utils.PiskelFileUtils.decodePiskelFile(content, function (piskel, descriptor, fps) {
|
||||
piskel.setDescriptor(descriptor);
|
||||
// store save path so we can re-save without opening the save dialog
|
||||
piskel.savePath = chosenFilename;
|
||||
piskel.savePath = savePath;
|
||||
pskl.app.piskelController.setPiskel(piskel);
|
||||
pskl.app.animationController.setFPS(fps);
|
||||
});
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
this.stateQueue = [];
|
||||
this.currentIndex = -1;
|
||||
|
||||
this.lastLoadState = -1;
|
||||
|
||||
this.saveNextAsSnapshot = false;
|
||||
|
@ -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
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user