Skip to content

Commit

Permalink
Use only one constant for extension
Browse files Browse the repository at this point in the history
  • Loading branch information
ks167484 authored and ks167484 committed Aug 9, 2024
1 parent 03a30be commit d3d155d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ private void updateScriptsAndBobFiles(File outputFolderFile) {
}

// Replace embedded opi by bob
newContains = newContains.replaceAll(OPI, BOB); // prevent replaceAll problem for opi becoming .bob in
newContains = newContains.replaceAll(OPI_EXTENSION, BOB_EXTENSION); // prevent replaceAll problem for opi becoming .bob in
// the bob file
newContains = newContains.replaceAll(OPI_EXTENSION, BOB_EXTENSION);
newContains = newContains.replaceAll(OPI_EXTENSION.toUpperCase(), BOB_EXTENSION.toUpperCase());
newContains = newContains.replaceAll("." + OPI_EXTENSION, "." + BOB_EXTENSION);
newContains = newContains.replaceAll("." + OPI_EXTENSION.toUpperCase(), "." + BOB_EXTENSION.toUpperCase());

// Replace name of script for phoebus => phoebus_scritfile.py
for (String scriptFile : scriptList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ public class Converter {
* @return all opi files contained in a given folder
*/
public static final String OUTPUT_ARG = "-output";
public static final String OPI_EXTENSION = ".opi";
public static final String BOB_EXTENSION = ".bob";
public static final String OPI = "opi";
public static final String BOB = "bob";
public static final String OPI_EXTENSION = "opi";
public static final String BOB_EXTENSION = "bob";
public static final String PYTHON_EXTENSION = ".python";
public static final String PY_EXTENSION = ".py";
public static final String JAVASCRIPT_EXTENSION = ".javascript";
Expand Down Expand Up @@ -135,7 +133,7 @@ public static boolean matchExtensions(String fileName, List<String> extensionsLi
boolean match = false;
if (fileName != null && extensionsList != null && !extensionsList.isEmpty()) {
for (String ext : extensionsList) {
if (fileName.toLowerCase().endsWith(ext)) {
if (fileName.toLowerCase().endsWith("." + ext)) {
match = true;
break;
}
Expand Down

0 comments on commit d3d155d

Please sign in to comment.