Skip to content

Commit

Permalink
Support for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumanta Pakira committed Aug 29, 2020
1 parent b237a51 commit 2d7baa2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>com.aem.component.generator</groupId>
<artifactId>component-generator</artifactId>
<version>1.4-SNAPSHOT</version>
<version>1.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.aem.component.generator</groupId>
<artifactId>component-generator</artifactId>
<version>1.4-SNAPSHOT</version>
<version>1.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>component-generator.core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class Constants {
public static final String DEFAULT_LOCAL_ADMIN_USER_NAME = "admin";
public static final String DEFAULT_LOCAL_ADMIN_USER_PASSWORD = "admin";
public static final String FORWARD_SLASH = "/";
public static final String BACK_SLASH = "\\";
public static final String UNDERSCORE = "_";
public static final String VAR_SETTING_NODE = "/var/component-generator/settings";
public static final String DOT = ".";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,14 @@ private static void writeToFile(Path file, String template) {
* @return
*/
private static String getPackageName(String folderPath) {
return StringUtils.substringAfter(folderPath, "main/java/").replaceAll(Constants.FORWARD_SLASH, Constants.DOT);
String osName= whichOS();
if((osName.indexOf("win") >= 0)){
return StringUtils.substringAfter(folderPath, "\\main\\java\\").replace(Constants.BACK_SLASH, Constants.DOT);
}else if((osName.indexOf("mac") >= 0)){
return StringUtils.substringAfter(folderPath, "main/java/").replaceAll(Constants.FORWARD_SLASH, Constants.DOT);
}else{
return StringUtils.EMPTY;
}
}

/**
Expand Down Expand Up @@ -524,4 +531,8 @@ private String getCoreModelPath(String coreModelDirPath) {

}

private static String whichOS(){
return System.getProperty("os.name").toLowerCase();
}

}
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<groupId>com.aem.component.generator</groupId>
<artifactId>component-generator</artifactId>
<packaging>pom</packaging>
<version>1.4-SNAPSHOT</version>
<version>1.5-SNAPSHOT</version>
<description>AEM component generator</description>

<modules>
Expand All @@ -45,6 +45,7 @@
<bnd.version>5.0.0</bnd.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<componentGroupName>sumanta.component.generator</componentGroupName>
</properties>

<build>
Expand Down
2 changes: 1 addition & 1 deletion ui.apps.structure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.aem.component.generator</groupId>
<artifactId>component-generator</artifactId>
<version>1.4-SNAPSHOT</version>
<version>1.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion ui.apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.aem.component.generator</groupId>
<artifactId>component-generator</artifactId>
<version>1.4-SNAPSHOT</version>
<version>1.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion ui.content/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.aem.component.generator</groupId>
<artifactId>component-generator</artifactId>
<version>1.4-SNAPSHOT</version>
<version>1.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down

0 comments on commit 2d7baa2

Please sign in to comment.