Welcome to the CHICKEN Scheme pasting service

Blergh added by sjamaan on Thu Jun 18 15:36:24 2015

        finalizeTransaction: function(transactionId, mServerContentBundle, done) {
            if (window.requestFileSystem) {
                window.requestFileSystem(
                    window.LocalFileSystem.PERSISTENT, 0,
                    function(fs) {
                        var tempPath = 'directresult/unfinishedTransactions/contentbundles/'+mServerContentBundle.id+'/'+transactionId,
                            finalPath = 'directresult/finishedTransactions/contentbundles/'+mServerContentBundle.id;

                        fs.root.getDirectory(
                            tempPath, {create: true, exclusive: false}, // just in case we get invoked REALLY early
                            function(tp) {
                                fs.root.getDirectory(
                                    'directresult/finishedTransactions', {create: true, exclusive: false},
                                    function(ip) {
                                        fs.root.getDirectory(
                                            finalPath, {create: true, exclusive: false},
                                            function(fp) {
                                                tp.moveTo(tp, fp, transactionId, done, function(e) {
                                                    this.rollbackTransaction(transactionId, mServerContentBundle, function() {
                                                        this.showError('Failed to move dir entry: '+JSON.stringify(e));
                                                    }.bind(this));
                                                });
                                            }.bind(this), function(e) {
                                                this.rollbackTransaction(transactionId, mServerContentBundle, function() {
                                                    this.showError('Failed to get final directory for '+finalPath+': '+JSON.stringify(e));
                                                }.bind(this));
                                            }.bind(this));
                                    }.bind(this), function(e) {
                                        this.rollbackTransaction(transactionId, mServerContentBundle, function() {
                                            this.showError('Failed to get intermediate directory: '+JSON.stringify(e));
                                        }.bind(this));
                                    }.bind(this));
                            }.bind(this), function(e) {
                                this.rollbackTransaction(transactionId, mServerContentBundle, function() {
                                    this.showError('Failed to get temp directory for '+tempPath+': '+JSON.stringify(e));
                                }.bind(this));
                            }.bind(this));
                    }.bind(this), function(e) {
                        this.rollbackTransaction(transactionId, mServerContentBundle, function() {
                            this.showError('Failed to get fs: '+JSON.stringify(e));
                        }.bind(this));
                    }.bind(this));
            } else {
                done();
            }
        }

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which backend storage does qwiki use?
Visually impaired? Let me spell it for you (wav file) download WAV