1 //
2 //	aegis - project change supervisor
3 //	Copyright (C) 1999, 2003-2008 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/change/file.h>
21 #include <libaegis/os/isa/path_prefix.h>
22 
23 
24 string_ty *
change_file_directory_conflict(change::pointer cp,string_ty * file_name)25 change_file_directory_conflict(change::pointer cp, string_ty *file_name)
26 {
27 	size_t		j;
28 	fstate_src_ty   *src_data;
29 
30 	for (j = 0; ; ++j)
31 	{
32 		//
33 		// include deleted files in the check,
34 		// so we can reconstruct later
35 		//
36 		// include built files in the check
37 		//
38 		src_data = change_file_nth(cp, j, view_path_first);
39 		if (!src_data)
40 			break;
41 		if
42 		(
43 			os_isa_path_prefix(file_name, src_data->file_name)
44 		||
45 			os_isa_path_prefix(src_data->file_name, file_name)
46 		)
47 			return src_data->file_name;
48 	}
49 	return 0;
50 }
51