Where is the download directory specified?

Hi,

I’m quite new to Lisp and I’m currently stuck on trying to understand a bit of code and I would appreciate it if anyone could help in my understanding.

So from what I can gather, in data-storage.lisp there is a function called xdg-download-dir and this is the function that specifies the download destination and the directory is gotten from (setf dir (str:concat (uiop:getenv "HOME") "/Downloads/")))

But when I change the directory to, for example, just the /Pictures/ directory the downloads keep going back to my /Downloads/ directory. I can’t seem to choose where the download destination is.

I’m currently working on a feature on Nyxt where the user can select which directory they want to download files to (issue #1523 on GitHub) hence why I’m doing this. I was trying to understand how download destinations work when I stumbled onto this problem. Can anyone please help point me in the right direction to understanding this code better? Thank you.

If you change that dir, and then make a new instance, does it change then? You have to be careful because changing the definition of something doesn’t change an instance. Try making a new buffer and then downloading, or a new instance of the *browser*.

It worked! Thank you. I made a new buffer and then downloaded something and it went to the destination I specified.

So correct me if I’m wrong my understanding is that when I change the destination dir it doesn’t change the existing instance. So if the existing instance has /Downloads/ as its dir then it won’t change even if I changed the dir to something else (like /Documents/ for example).

That change will only be applied when I make a new instance. In this case, by creating a new buffer and then downloading. Is that right?

You are 100% correct!

1 Like

Speaking of this, currently Save as doesn’t work as intended because it just downloads to the default location instead of prompting the user for the destination folder and file name.

I’m actually currently working on that feature you mentioned but I’ve run into an obstacle so I’m stuck with this problem. You can see the discussion I’ve had with @jmercouris about this here. Feel free to chime in if you have any ideas!