| 1176 | static std::recursive_mutex file_copy_mutex; |
| 1177 | |
| 1178 | LPCSTR CLocatorAPI::update_path(string_path& dest, LPCSTR initial, LPCSTR src) |
| 1179 | { |
| 1180 | static bool dev_reference_copy = !!strstr(Core.Params, "-dev_reference_copy"); |
| 1181 | |
| 1182 | string_path src_origin{}; |
| 1183 | |
| 1184 | if (dev_reference_copy || gamedata_unused_references) |
| 1185 | { |
| 1186 | strcpy_s(src_origin, sizeof(src_origin), src); |
| 1187 | } |
| 1188 | |
| 1189 | LPCSTR r = get_path(initial)->_update(dest, src); |
| 1190 | |
| 1191 | if (dev_reference_copy) |
| 1192 | { |
| 1193 | std::scoped_lock lock(file_copy_mutex); |
| 1194 | |
| 1195 | string_path fn_ref; |
| 1196 | |
| 1197 | if (strcmp(initial, fsgame::game_sounds) == 0) |
| 1198 | { |
| 1199 | if (!exist(dest)) |
| 1200 | { |
| 1201 | if (exist(fn_ref, fsgame::game_sounds_reference, src_origin)) |
| 1202 | { |
| 1203 | Msg("[NFTC]: Sound founded: [%s] in $game_sounds_reference$ folder. Copying begins...", src_origin); |
| 1204 | file_copy(fn_ref, dest); |
| 1205 | } |
| 1206 | } |
| 1207 | } |
| 1208 | else if (strcmp(initial, fsgame::game_textures) == 0) |
| 1209 | { |
| 1210 | if (!exist(dest)) |
| 1211 | { |
| 1212 | if (exist(fn_ref, fsgame::game_textures_reference, src_origin)) |
| 1213 | { |
| 1214 | Msg("[NFTC]: Texture founded: [%s] in $game_textures_reference$ folder. Copying begins...", src_origin); |
| 1215 | file_copy(fn_ref, dest); |
| 1216 | } |
| 1217 | } |
| 1218 | } |
| 1219 | else if (strcmp(initial, fsgame::game_meshes) == 0) |
| 1220 | { |
| 1221 | if (!exist(dest)) |
| 1222 | { |
| 1223 | if (exist(fn_ref, fsgame::game_meshes_reference, src_origin)) |
| 1224 | { |
| 1225 | Msg("[NFTC]: Mesh founded: [%s] in $game_meshes_reference$ folder. Copying begins...", src_origin); |
| 1226 | file_copy(fn_ref, dest); |
| 1227 | } |
| 1228 | } |
| 1229 | } |
| 1230 | } |
| 1231 | |
| 1232 | // v2 )) |
| 1233 | |
| 1234 | if (gamedata_unused_references) |
| 1235 | { |
no test coverage detected