Forum > Operating Systems

[Solved] Get user pictures directory name in Windows and Linux

<< < (2/2)


--- Quote from: MarkMLl on September 10, 2022, 10:53:54 am ---....Linux you're entirely at the mercy of the selected distro and the window manager (desktop environment etc.) that you're currently running.

--- End quote ---

While Mark is definitely right, there is no certain answer. But a pretty good guess on a desktop system is ~/Pictures - don't assume its there, always check, but its there in all my VBVMs including Debian (and Ubuntu, Mint, MXLinux), Fedora, Manjaro. The major Desktops seem to agree ...

Maybe someone can confirm Arch and SUSE.

~/ refers to user home directory, get that from the $HOME env var.

Not certain, but a good place to start. Mind you, its Linux we are talking about, just because the directory exits, the user may like to put their pictures somewhere else.



--- Quote from: Kays on September 10, 2022, 02:13:56 pm ---Are there any real-life users out there who actually used the pre-created directories “My Pictures” etc. in their intended way? It was the first thing I deleted.
--- End quote ---

I do. And I either use them as is or redirect them (mainly the Downloads directory). The later also updates what the API functions return.

Thanks all. I need this for set default directory for screen capture program. So no need to run it on servers without GUI. I think using GetWindowsSpecialDirUnicode(CSIDL_MYPICTURES) + ~/Pictures enough for my case.


[0] Message Index

[*] Previous page

Go to full version