Skip to content

Commit

Permalink
Migrated .bat scripts to .cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
rmraya committed Oct 24, 2024
1 parent a2e9a32 commit 8370a6d
Show file tree
Hide file tree
Showing 24 changed files with 171 additions and 162 deletions.
207 changes: 104 additions & 103 deletions README.md

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@
<delete file="dist/lib/jrt-fs.jar" />
</target>
<target name="copyBats" if="isWindows">
<description>Copy .bat to /dist</description>
<copy file="convert.bat" todir="dist" />
<copy file="merge.bat" todir="dist" />
<copy file="xliffchecker.bat" todir="dist" />
<copy file="analysis.bat" todir="dist" />
<copy file="join.bat" todir="dist" />
<copy file="pseudotranslate.bat" todir="dist" />
<copy file="copysources.bat" todir="dist" />
<copy file="removetargets.bat" todir="dist" />
<copy file="approveall.bat" todir="dist" />
<copy file="exporttmx.bat" todir="dist" />
<description>Copy .cmd to /dist</description>
<copy file="convert.cmd" todir="dist" />
<copy file="merge.cmd" todir="dist" />
<copy file="xliffchecker.cmd" todir="dist" />
<copy file="analysis.cmd" todir="dist" />
<copy file="join.cmd" todir="dist" />
<copy file="pseudotranslate.cmd" todir="dist" />
<copy file="copysources.cmd" todir="dist" />
<copy file="removetargets.cmd" todir="dist" />
<copy file="approveall.cmd" todir="dist" />
<copy file="exporttmx.cmd" todir="dist" />
</target>
<target name="copyShells" unless="isWindows">
<description>Copy .sh to /dist</description>
Expand Down
8 changes: 4 additions & 4 deletions convert.bat → convert.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
pushd "%~dp0"
set OpenXLIFF_HOME=%CD%
popd
@echo off
pushd "%~dp0"
set OpenXLIFF_HOME=%CD%
popd
%OpenXLIFF_HOME%\bin\java.exe --module-path %OpenXLIFF_HOME%\lib -m openxliff/com.maxprograms.converters.Convert %*
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file modified lib/openxliff.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions merge.bat → merge.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
pushd "%~dp0"
set OpenXLIFF_HOME=%CD%
popd
@echo off
pushd "%~dp0"
set OpenXLIFF_HOME=%CD%
popd
%OpenXLIFF_HOME%\bin\java.exe --module-path %OpenXLIFF_HOME%\lib -m openxliff/com.maxprograms.converters.Merge %*
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion src/com/maxprograms/converters/ApproveAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public static void main(String[] args) {

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("ApproveAll.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "approveall.bat" : "approveall.sh" });
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "approveall.cmd" : "approveall.sh" });
System.out.println(help);
}

Expand Down
4 changes: 2 additions & 2 deletions src/com/maxprograms/converters/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ private Constants() {

public static final String TOOLID = "OpenXLIFF";
public static final String TOOLNAME = "OpenXLIFF Filters";
public static final String VERSION = "3.22.0";
public static final String BUILD = "20240926_0709";
public static final String VERSION = "3.23.0";
public static final String BUILD = "20241024_0743";

public static final String SUCCESS = "0";
public static final String ERROR = "1";
Expand Down
5 changes: 3 additions & 2 deletions src/com/maxprograms/converters/Convert.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public static void main(String[] args) {
if (xliff.isEmpty()) {
xliff = sourceFile.getAbsoluteFile().getAbsolutePath() + ".xlf";
}

if (xliff20 && xliff21) {
logger.log(Level.ERROR, Messages.getString("Convert.21"));
return;
Expand Down Expand Up @@ -337,7 +337,8 @@ public static void main(String[] args) {

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("Convert.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "convert.bat" : "convert.sh" });
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "convert.cmd" : "convert.sh" });
System.out.println(help);
}

Expand Down
7 changes: 4 additions & 3 deletions src/com/maxprograms/converters/CopySources.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ public static void main(String[] args) {
}

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("CopySources.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "copysources.bat" : "copysources.sh" });
System.out.println(help);
MessageFormat mf = new MessageFormat(Messages.getString("CopySources.help"));
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "copysources.cmd" : "copysources.sh" });
System.out.println(help);
}

public static void copySources(String xliff, String catalog)
Expand Down
11 changes: 6 additions & 5 deletions src/com/maxprograms/converters/Join.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public static void main(String[] args) {
}
}

File targetFile = new File(target);
if (!targetFile.isAbsolute()) {
target = targetFile.getAbsoluteFile().getAbsolutePath();
}
File targetFile = new File(target);
if (!targetFile.isAbsolute()) {
target = targetFile.getAbsoluteFile().getAbsolutePath();
}
try {
join(list, target);
} catch (IOException | SAXException | ParserConfigurationException ex) {
Expand All @@ -97,7 +97,8 @@ public static void main(String[] args) {

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("Join.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "join.bat" : "join.sh" });
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "join.cmd" : "join.sh" });
System.out.println(help);
}

Expand Down
7 changes: 4 additions & 3 deletions src/com/maxprograms/converters/Merge.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static void main(String[] args) {
File catalogFolder = new File(new File(home), "catalog");
if (!catalogFolder.exists()) {
MessageFormat mf = new MessageFormat(Messages.getString("Merge.05"));
logger.log(Level.ERROR, mf.format(new String[]{catalogFolder.getAbsolutePath()}));
logger.log(Level.ERROR, mf.format(new String[] { catalogFolder.getAbsolutePath() }));
return;
}
catalog = new File(catalogFolder, "catalog.xml").getAbsolutePath();
Expand All @@ -170,7 +170,7 @@ public static void main(String[] args) {
}
if (!Constants.SUCCESS.equals(result.get(0))) {
MessageFormat mf = new MessageFormat(Messages.getString("Merge.07"));
logger.log(Level.ERROR, mf.format(new String[]{result.get(1)}));
logger.log(Level.ERROR, mf.format(new String[] { result.get(1) }));
}
}

Expand Down Expand Up @@ -265,7 +265,8 @@ public static List<String> merge(String xliff, String target, String catalog, bo

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("Merge.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "merge.bat" : "merge.sh" });
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "merge.cmd" : "merge.sh" });
System.out.println(help);
}

Expand Down
13 changes: 7 additions & 6 deletions src/com/maxprograms/converters/PseudoTranslation.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public static void main(String[] args) {
}
if (catalog.isEmpty()) {
String home = System.getenv("OpenXLIFF_HOME");
if (home == null) {
home = System.getProperty("user.dir");
}
if (home == null) {
home = System.getProperty("user.dir");
}
File catalogFolder = new File(new File(home), "catalog");
if (!catalogFolder.exists()) {
logger.log(Level.ERROR, Messages.getString("PseudoTranslation.1"));
Expand Down Expand Up @@ -95,9 +95,10 @@ public static void main(String[] args) {
}

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("PseudoTranslation.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "pseudotranslate.bat" : "pseudotranslate.sh" });
System.out.println(help);
MessageFormat mf = new MessageFormat(Messages.getString("PseudoTranslation.help"));
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "pseudotranslate.cmd" : "pseudotranslate.sh" });
System.out.println(help);
}

public static void pseudoTranslate(String xliff, String catalog)
Expand Down
15 changes: 8 additions & 7 deletions src/com/maxprograms/converters/RemoveTargets.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public static void main(String[] args) {
}
if (catalog.isEmpty()) {
String home = System.getenv("OpenXLIFF_HOME");
if (home == null) {
home = System.getProperty("user.dir");
}
if (home == null) {
home = System.getProperty("user.dir");
}
File catalogFolder = new File(new File(home), "catalog");
if (!catalogFolder.exists()) {
logger.log(Level.ERROR, Messages.getString("RemoveTargets.1"));
Expand All @@ -77,7 +77,7 @@ public static void main(String[] args) {
}
if (!catalogFile.isAbsolute()) {
catalog = catalogFile.getAbsoluteFile().getAbsolutePath();
}
}
File xliffFile = new File(xliff);
if (!xliffFile.isAbsolute()) {
xliff = xliffFile.getAbsoluteFile().getAbsolutePath();
Expand Down Expand Up @@ -130,9 +130,10 @@ private static void recurse(Element root) {
}

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("RemoveTargets.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "removetargets.bat" : "removetargets.sh" });
System.out.println(help);
MessageFormat mf = new MessageFormat(Messages.getString("RemoveTargets.help"));
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "removetargets.cmd" : "removetargets.sh" });
System.out.println(help);
}

}
9 changes: 4 additions & 5 deletions src/com/maxprograms/converters/TmxExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,14 @@ public static void main(String[] args) {
if (tmx.isEmpty()) {
tmx = xliff + ".tmx";
}

export(xliff, tmx, catalog);
}

private static void help() {
MessageFormat mf = new MessageFormat(
Messages.getString("TmxExporter.3"));
String help = mf.format(
new String[] { "\\".equals(File.pathSeparator) ? "exporttmx.bat" : "exporttmx.sh" });
MessageFormat mf = new MessageFormat(Messages.getString("TmxExporter.3"));
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "exporttmx.cmd" : "exporttmx.sh" });
System.out.println(help);
}

Expand Down
3 changes: 2 additions & 1 deletion src/com/maxprograms/stats/RepetitionAnalysis.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public static void main(String[] args) {

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("RepetitionAnalysis.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "analysis.bat" : "analysis.sh" });
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows? "analysis.cmd" : "analysis.sh" });
System.out.println(help);
}

Expand Down
3 changes: 2 additions & 1 deletion src/com/maxprograms/validation/XliffChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ public static void main(String[] args) {

private static void help() {
MessageFormat mf = new MessageFormat(Messages.getString("XliffChecker.help"));
String help = mf.format(new String[] { "\\".equals(File.pathSeparator) ? "xliffchecker.bat" : "xliffchecker.sh" });
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
String help = mf.format(new String[] { isWindows ? "xliffchecker.cmd" : "xliffchecker.sh" });
System.out.println(help);
}

Expand Down
8 changes: 4 additions & 4 deletions xliffchecker.bat → xliffchecker.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
pushd "%~dp0"
set OpenXLIFF_HOME=%CD%
popd
@echo off
pushd "%~dp0"
set OpenXLIFF_HOME=%CD%
popd
%OpenXLIFF_HOME%\bin\java.exe --module-path %OpenXLIFF_HOME%\lib -m openxliff/com.maxprograms.validation.XliffChecker %*

0 comments on commit 8370a6d

Please sign in to comment.