Skip to content

Commit

Permalink
Change EnvJsonUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstMegaGame4 committed Dec 26, 2023
1 parent 91e5e15 commit 94208a7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/main/java/fr/firstmegagame4/env/json/impl/EnvJsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,23 @@ public static boolean isEnvJson(Identifier identifier) {
return identifier.getPath().endsWith(".env.json");
}

public static String getFileExtension(Identifier identifier) {
return identifier.getPath().substring(identifier.getPath().lastIndexOf("."));
}

public static Identifier getEnvJsonFileName(Identifier identifier) {
return identifier.withPath(identifier.getPath().substring(0, identifier.getPath().length() - ".env.json".length()));
String path;
if (identifier.getPath().contains("-")) {
int index = identifier.getPath().lastIndexOf("-");
path = identifier.getPath().substring(0, index) + "." + identifier.getPath().substring(index + 1);
}
else {
path = identifier.getPath();
}
return identifier.withPath(path.substring(0, path.length() - ".env.json".length()));
}

public static Identifier getEnvJsonPath(Identifier identifier) {
String path;
if (identifier.getPath().contains(".")) {
path = identifier.getPath().substring(0, identifier.getPath().lastIndexOf("."));
int index = identifier.getPath().lastIndexOf(".");
path = identifier.getPath().substring(0, index) + "-" + identifier.getPath().substring(index + 1);
}
else {
path = identifier.getPath();
Expand Down

0 comments on commit 94208a7

Please sign in to comment.