-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nwworkingdir is not working on Windows #3372
Comments
Can you post the results from devtools:
|
I've tried the below element and the value is set as "C:\Windows" thru the javascript.
It would be helpful if you could tell how you're using the Yeah, I stripped the code from the tests. |
Seem #2948 seems the same problem. I am also still waiting for a bugfix. |
Hey, all! After a LOT of trial and error, I stumbled across a scenario for me that works. It seems, on Windows, setting other attributes essentially causes In other words, this worked: But this didn't: Buuuuut... I realized that a "saveas" path doesn't have to be relative, therefore I tried: This worked! I used jQuery to build it, so it's not the same as these examples, but this is my final working code on Windows: var input = '<input type="file" ';
var fullPath = F.fullPath(options.path);
if(options.type) {
if(options.type === 'saveas') {
input+='nwsaveas="' + fullPath + Path.sep + options.name + '" ';
}
else if(options.type === 'openDirectory') {
input+='nwdirectory ';
}
}
input+='nwworkingdir="' + fullPath + '" />';
var $dialog = $(input);
$dialog.on('change', function() {
callback.call(this);
$dialog = null;
});
$dialog.click(); Hope that helps. (End note: it would be nice to finally have a real File API for this, instead of this insanity. I'm not sure on what planet this is supposed to be friendly to developers.) |
@matthew-dean how could you find that. You made my day! |
@fritx In web developer years, I'm about 1,000 years old, lol. So it's just lots of experience problem-solving. And: no problem! Hope it helped you. |
input.setAttribute('nwworkingdir', 'C:\Windows') // wont work
input.setAttribute('nwsaveas', 'filename') const fullPath = join(dir, filename)
const input = document.createElement('input')
input.setAttribute('type', 'file')
input.setAttribute('nwsaveas', fullPath) // absolute path works
input.addEventListener('change', ({ target }) => {
// target.files[0].path
saveTo(target.value)
})
input.click() The above solution worked fine in nw 0.12.3, however, it seems to remember last chosen savepath everytime ignoring In nw18, the a filename (not fullPath) should be provided to |
@fritx Are you saying that setting the full path to |
Yes, last time I've tried it both in Mac 10.11 and Windows 7. |
|
close until there is more information. |
Just for your info. We're running |
Similar issue: |
|
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: