Skip to content

Commit a14bb35

Browse files
authored
Merge pull request #384 from pmienk/master
Alter collision map computation by stripping filetype
2 parents 88448f1 + faea8f4 commit a14bb35

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

templates/gsl.vcxproj

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,37 +102,41 @@ endfunction
102102
###
103103
### generic assistance functions
104104
###
105+
function unsuffix(name)
106+
return string.substr(my.name, 0, string.locate_last(my.name, ".") - 1)
107+
endfunction
108+
105109
function match_name(element, name)
106110
define my.element = match_name.element
107111
return defined(my.element) & (my.element.name = my.name)
108112
endfunction
109113

110-
function exists_unsuffixed_collision(root, name)
111-
define my.root = exists_unsuffixed_collision.root
112-
define my.unsuffixed = string.substr(my.name, 0, string.locate_last(my.name, "."))
113-
return count(my.root.collision, match_name(count, my.unsuffixed)) > 0
114+
function match_unsuffixed(element, name)
115+
define my.element = match_unsuffixed.element
116+
if (unsuffix(my.element.name) = unsuffix(my.name))
117+
endif
118+
119+
return defined(my.element) & (unsuffix(my.element.name) = unsuffix(my.name))
114120
endfunction
115121

116122
function exists_collision(root, name)
117123
define my.root = exists_collision.root
118-
return count(my.root.collision, match_name(count, my.name)) > 0
124+
return count(my.root.collision, match_unsuffixed(count, my.name)) > 0
119125
endfunction
120126

121127
function add_collision(root, name)
122128
define my.root = add_collision.root
123-
define my.unsuffixed = string.substr(my.name, 0, string.locate_last(my.name, "."))
124-
125-
if (defined(my.root) & !exists_collision(my.root, my.unsuffixed))
129+
if (defined(my.root) & !exists_collision(my.root, my.name))
126130
new my.root.collision as _collision
127-
_collision.name = my.unsuffixed
131+
_collision.name = my.name
128132
endnew
129133
endif
130134
return my.root
131135
endfunction
132136

133137
function collides_file_name(root, name)
134138
define my.root = collides_file_name.root
135-
return count(my.root.file, match_name(count, my.name)) > 1
139+
return count(my.root.file, match_unsuffixed(count, my.name)) > 1
136140
endfunction
137141

138142
function populate_collisions(collisions, file_data)
@@ -806,7 +810,7 @@ endfunction emit_project
806810
. define my.collisions = emit_compile_item.collisions
807811
. define my.file_record = emit_compile_item.file_record
808812
.
809-
. if (!exists_unsuffixed_collision(my.collisions, my.file_record.name))
813+
. if (!exists_collision(my.collisions, my.file_record.name))
810814
. emit_file_record_item("ClCompile", my.file_record)
811815
. else
812816
. emit_item_with_object("ClCompile", my.file_record)

0 commit comments

Comments
 (0)