vendredi 20 février 2015

Node Webkit program crashes with nwdirectory

I'm trying to create a directory selection dialog in my node webkit program.


According to the documentation I just have to add nwdirectory to my file dialog.


Every time I use the file dialog, after selecting a folder and clicking ok, my program will hang for a few seconds, and then exit without any error messages.


I've attempted to use the webkit flag webkitdirectory, as well, with the same result.


I append the locator to my settings window using jQuery:



settings.append($('<input style="display:none;" id="fileDialog" nwdirectory type="file"/>'));
settings.append($('<span class="saveLoc">'+ options['savelocation'] +'</span>'));


and I bind it using the function from the documentation:



function chooseFile(name) {
var chooser = $(name);
chooser.change(function(evt) {
console.log($(this).val());
});
chooser.trigger('click');
}
settings.find('.saveLoc').click(function(){
chooseFile('#fileDialog');
});


The code works if I remove the nwdirectory flag, but then the user can only select files, not folders.


Am I making a mistake? And if not, is there any way for me to extract information about the cause of the crash?


Thanks!


Aucun commentaire:

Enregistrer un commentaire