1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2006-2008, 2011, 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/project.h>
22 #include <libaegis/os.h>
23
24
25 string_ty *
baseline_path_get(bool resolve)26 project::baseline_path_get(bool resolve)
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(("project_baseline_path_get(this = %p)\n{\n", this));
36 if (!baseline_path_unresolved)
37 {
38 string_ty *dd = project_top_path_get(this, 0);
39 baseline_path_unresolved = str_format("%s/baseline", dd->str_text);
40 }
41 string_ty *result = 0;
42 if (!resolve)
43 result = baseline_path_unresolved;
44 else
45 {
46 if (!baseline_path)
47 {
48 project_become(this);
49 baseline_path = os_pathname(baseline_path_unresolved, 1);
50 project_become_undo(this);
51 }
52 result = baseline_path;
53 }
54 trace(("return \"%s\";\n", result->str_text));
55 trace(("}\n"));
56 return result;
57 }
58
59
60 // vim: set ts=8 sw=4 et :
61