Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/main/java/functional/tests/core/mobile/appium/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,27 @@ private File getAppiumExecutable() throws AppiumException {

// Check if exists
File appiumExecutable = new File(appiumPath);
try {
if (isSymlink(appiumExecutable)) {
LOGGER_BASE.info("Symlink");
LOGGER_BASE.info(appiumExecutable.getAbsolutePath());
try {
LOGGER_BASE.info(appiumExecutable.getCanonicalPath());
} catch (IOException e) {
e.printStackTrace();
}
} else {
LOGGER_BASE.info("Not a Symlink");
}
} catch (IOException e) {
e.printStackTrace();
}
LOGGER_BASE.info(appiumExecutable.getAbsolutePath());
try {
LOGGER_BASE.info(appiumExecutable.getCanonicalPath());
} catch (IOException e) {
e.printStackTrace();
}

if (!appiumExecutable.exists()) {
String error = "Appium does not exist at: " + appiumPath;
Expand All @@ -174,4 +195,17 @@ public String getServerLogs() {
return "";
}
}

public static boolean isSymlink(File file) throws IOException {
if (file == null)
throw new NullPointerException("File must not be null");
File canon;
if (file.getParent() == null) {
canon = file;
} else {
File canonDir = file.getParentFile().getCanonicalFile();
canon = new File(canonDir, file.getName());
}
return !canon.getCanonicalFile().equals(canon.getAbsoluteFile());
}
}