Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current user path in Linux?

Tags:

linux

gtk

How can I get the current user path in Linux? It can be either with the GTK+ framework APIs, or plain C++.

like image 381
boom Avatar asked Dec 22 '22 20:12

boom


2 Answers

Assuming you mean the current directory of the process:

  • The plain POSIX C function is getcwd().
  • In glib, there's also g_get_current_dir().
like image 85
unwind Avatar answered Jan 05 '23 17:01

unwind


If you want to get home directory use getenv("HOME")

like image 31
DReJ Avatar answered Jan 05 '23 15:01

DReJ