wootscootinboogie
wootscootinboogie

Reputation: 8695

Java / Selenium relative paths

I have a relative file for a file upload

private String myPath= "..server\\app\\src\\test\\resources";

that is checked into source control. Everyone will have the same file structure for their file including and after server. However, since developers might have their repositories n different directories, I can't hard code the entire file path. How can I get the fully qualified file path from the relative path?

Upvotes: 3

Views: 665

Answers (1)

bruno
bruno

Reputation: 2273

Use

String absolutePath = new File(myPath).getAbsolutePath();

Upvotes: 1

Related Questions