1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2007, 2008, 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see
17 // <http://www.gnu.org/licenses/>.
18 //
19
20 #include <common/trace.h>
21 #include <libaegis/os.h>
22 #include <libaegis/user.h>
23
24
25 nstring
default_project_directory()26 user_ty::default_project_directory()
27 {
28 //
29 // To cope with automounters, directories are stored as given,
30 // or are derived from the home directory in the passwd file.
31 // Within aegis, pathnames have their symbolic links resolved,
32 // and any comparison of paths is done on this "system idea"
33 // of the pathname.
34 //
35 trace(("user_ty::default_project_directory(this = %p)\n{\n",
36 this));
37 uconf_ty *ucp = uconf_get();
38 nstring path(ucp->default_project_directory);
39 if (path.empty())
40 path = get_home();
41 else if (path[0] != '/')
42 path = os_path_join(get_home(), path);
43 trace(("return %s;\n", path.quote_c().c_str()));
44 trace(("}\n"));
45 return path;
46 }
47
48
49 // vim: set ts=8 sw=4 et :
50