I have the following path:
com/teama/merc/test/resTest
And I want to convert it to this:
com\teama\merc\test\resTest
I am trying to append the above path to this path:
C:\Users\Toby\git\MERCury\MERCury\
With str.replace('/', '\\');
But when I append both of the strings together, this is the output:
C:\Users\Toby\git\MERCury\MERCury\com/teama/merc/test/resTest
Here is the code in question:
String home = System.getProperty("user.dir");
path.replace('/', '\\');
System.out.println(path);
String folder = home + File.separatorChar + path;
System.out.println(folder);
File file = new File(folder);
if(file.isDirectory())
{
System.out.println(file.getPath() + " is a directory");
}
The appended path is not seen as a folder because of the slashes. Any help?
Edit: Just to clarify, the full path (both strings appended) is infact a folder.