1 //
2 // aegis - project change supervisor
3 // Copyright (C) 1999, 2002-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 <libaegis/os/isa/path_prefix.h>
21 #include <libaegis/project/file.h>
22
23
24 string_ty *
project_file_directory_conflict(project * pp,string_ty * file_name)25 project_file_directory_conflict(project *pp, string_ty *file_name)
26 {
27 size_t j;
28 fstate_src_ty *src_data;
29
30 for (j = 0; ; ++j)
31 {
32 //
33 // Don't include deleted files in the check, so that directories
34 // of removed files can re-used as file names. This can
35 // sometimes cause errors (unix will barf) when the user tries
36 // to reconstruct later and they want mixed deltas in their
37 // development directory.
38 //
39 // There used to be a larger problem where the history tool
40 // could have a filename collision. With the advent of the
41 // UUIDs, this is a vanishing concern.
42 //
43 // include built files in the check
44 //
45 src_data = pp->file_nth(j, view_path_extreme);
46 if (!src_data)
47 break;
48 if
49 (
50 os_isa_path_prefix(file_name, src_data->file_name)
51 ||
52 os_isa_path_prefix(src_data->file_name, file_name)
53 )
54 return src_data->file_name;
55 }
56 return 0;
57 }
58
59
60 // vim: set ts=8 sw=4 et :
61