[Solved] Get user pictures directory name in Windows and Linux lazarus / 23-Operating Systems ---------------------------------------------------------------------- artem101 · 2022-09-10 08:21 What is cross-platform way to get user pictures dir on Windows and Linux? Like "C:\Documents and Settings\user\My Documents\My Pictures" in Windows XP, "C:\Users\user\Pictures" in Windows 7 and later, "/home/user/Pictures" in Linux. ---------------------------------------------------------------------- MarkMLl · 2022-09-10 08:53 I can't speak for Windows, but in the case of Linux you're entirely at the mercy of the selected distro and the window manager (desktop environment etc.) that you're currently running. Refer to xdg-user-dir and related xdg utilities as shown by the apropos command, but note that support might be patchy and might be completely missing on a system set up as a server. MarkMLl ---------------------------------------------------------------------- KodeZwerg · 2022-09-10 09:17 for windows: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  ... shfolder .... ... function GetSpecialFolder(const CSIDL: Integer): string;var  i: Integer;begin SetLength(Result, MAX_PATH); ShGetFolderPath(0, CSIDL, 0, 0, PChar(Result)); i := Pos(#0, Result); if (i > 0) then   SetLength(Result, pred(i));end; ... var  s: string;begin s := GetSpecialFolder(CSIDL_MYPICTURES); ... ---------------------------------------------------------------------- Josh · 2022-09-10 09:25 windows only uses windirs; var s:unicodestring; begin   s:=GetWindowsSpecialDirUnicode(CSIDL_MYPICTURES); end; ---------------------------------------------------------------------- Kays · 2022-09-10 12:13 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.Quote from: artem101 on September 10, 2022, 10:21:15 amWhat is cross-platform way to get user pictures dir on Windows and Linux? […]Frankly, I would treat the notion of “special” directories as nonexistent. Only that is cross-platform. Quote from: MarkMLl on September 10, 2022, 10:53:54 am[…] Refer to xdg-user-dir and related xdg utilities as shown by the apropos command, but note that support might be patchy and might be completely missing on a system set up as a server. […]The XDG utilities are at least mentioned in the Linux Standard Base. However, xdg‑user‑dir(1) is not a mandatory utility, therefore it may be missing on the specific machine. Not worth mentioning, there are/were hardly any distros fully supporting the LSB, so your statement “at the mercy of the selected distro” is quite accurate. ---------------------------------------------------------------------- dbannon · 2022-09-10 12:14 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. 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. Davo ---------------------------------------------------------------------- PascalDragon · 2022-09-11 15:34 Quote from: Kays on September 10, 2022, 02:13:56 pmAre 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. 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. ---------------------------------------------------------------------- artem101 · 2022-09-11 20:34 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.