File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -334,20 +334,12 @@ library LibInitializeGuard {
334
334
}
335
335
336
336
function _getContractNameFromAbsolutePath (string memory path ) internal pure returns (string memory contractName ) {
337
- bytes memory pathBytes = bytes (path);
338
- uint256 length = pathBytes.length ;
339
- bytes memory contractNameBytes = new bytes (length - 4 );
340
-
341
- if (
342
- length > 4 && pathBytes[length - 4 ] == ". " && pathBytes[length - 3 ] == "s " && pathBytes[length - 2 ] == "o "
343
- && pathBytes[length - 1 ] == "l "
344
- ) {
345
- // Create a new bytes array without the ".sol" extension
346
- for (uint256 i = 0 ; i < length - 4 ; i++ ) {
347
- contractNameBytes[i] = pathBytes[i];
348
- }
337
+ uint256 length = bytes (path).length ;
338
+ // Remove ".sol"
339
+ if (path.endsWith (".sol " )) {
340
+ contractName = path.slice (0 , length - 4 );
349
341
}
350
- return string (contractNameBytes );
342
+ return string (contractName );
351
343
}
352
344
353
345
/**
You can’t perform that action at this time.
0 commit comments