where is the downloads folder in MSYS2?

I’m stumped - stack overflow didn’t tell me the answer. In normal Linux Downloads are in ~/Downloads. Where is this folder in the msys2 version of bash on windows? Other than the obvious and non-Unix /c/Users/<username>/Downloads

Maybe under C:\msys64\home<user>?

I don’t think so.

Where is it in msys2? Not where one would expect.

On Linux, your downloads directory is usually defined by XDG well-known directories, and if XDG_DOWNLOAD_DIR isn’t defined, applications like Firefox and Chrome often choose $HOME/Downloads.

But there isn’t a reason to use XDG directories on MSYS2, since Windows defines user directories already. Firefox and Chrome choose <user profile folder>/Downloads by default. On Windows, you’d get this path with something like

PWSTR path = NULL;
HRESULT hr = SHGetKnownFolderPath(&FOLDERID_Downloads, 0, NULL, &path);
if (hr) {
  ...
}
1 Like

In MSYS2 my user is “labj
My $HOME there is /home/labj
In Windows terms, /home/labj is c:\msys2\home\labj (on my installation).

That directory is empty, only a handful of standard dot-files, no downloads directory. I think that’s your answer.

Now, MSYS2 is not a Linux box, it’s a minimal POSIX environment inside Windows (based on Cygwin), made for compiling POSIX programs so they will run on Windows, or for running a subset of POSIX programs on Windows (like Git).

All the executables/binaries that run inside MSYS2, or are produced by compiling in MSYS2, are Windows programs, but they think they run inside a POSIX environment, with the aid of helper libraries, whilst at the same time having access to the Windows environment. It’s a bridging technology that e.g. Rack makes use of to produce a cross-platform application, since its two other target platforms (Mac, Linux) are POSIX environments.

It’s cooked up by some clever minds (Cygnus, Red Hat) thinking: How can we make all our great Linux/Unix/POSIX programs and libraries run on Windows. Because MS/Windows went their own way and kinda said “f.ck all that POSIX and Ansi shite”. It’s funny that they’re coming around the other way again now, because that’s where their customers, and especially the developers are, and they were loosing them.

So I think there’s only two ways to think about it:

  1. There is no downloads folder, or
  2. Your downloads folder is your Windows users’ downloads folder, which in MSYS2 can be reached at $USERPROFILE/Downloads

Inside MSYS2 it’s instructive to run env|sort

If you want a Linux box inside windows, I can recommend WSL (Windows Subsystem for Linux) as a great option, works very well for text based applications, it’s not for a GUI environment. This is not for compiling Rack (or plugins) for Windows, like MSYS2, but you can use it to compile them for Linux, or just as a great Linux environment without having to fiddle with VM’s.

2 Likes

So neatly cleared up. @LarsBjerregaard thanks, you made my day!

1 Like

sounds totally right. I guess I do use msys2 as a “unix box”, since you can do an awful lot of stuff from inside that bash implementation. I expected them to map ~/Downloads, but now I realize that would be a pretty slippery slope in a direction msys2 would not want to go.

Tx for clarifying this for me!

1 Like