'I am using org.apache.commons.exec.CommandLine and it keeps changing window paths into Linux paths

I have taken over code that uses CommandLine from the jar commons-exec-1.3.jar

org.apache.commons.exec.CommandLine

This code will return a linux path \opt\prog\bin\

cmd = new CommandLine("/opt/prog/bin/");

This code will return a linux path \opt\prog\bin\

cmd = CommandLine.parse("/opt/prog/bin/");

There is this code where I can substitute / for / still returns a linux path \opt\prog\bin\

Map <String, String > map = new HashMap<String, String >();
map.put("/", "/");
cmd = CommandLine.parse("/opt/prog/bin/", map);

And then I started spit balling anything to get it working

Map <String, String > map = new HashMap<String, String >();
map.put("\\", "/");
cmd = CommandLine.parse("/opt/prog/bin/", map);
String linux2 = cmd.toString();
 map = new HashMap<String, String >();
map.put("/", "\\");
cmd = CommandLine.parse("/opt/prog/bin/",  map);
String linux3 = cmd.toString();

Nothing works, I cant believe that this code is only used to turn windows paths into Linux paths.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source