io.github.eliux.mega.platform.OSPlatform Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of megacmd4j Show documentation
Show all versions of megacmd4j Show documentation
Java client library that works on top of MEGAcmd to provide access to the services of Mega.nz
package io.github.eliux.mega.platform;
/**
* Abstractions to encapsulate Operative System/Platforms specific actions.
* E.g.: Running the MEGAcmd commands.
*/
public abstract class OSPlatform {
private static OSPlatform current;
public static OSPlatform getCurrent() {
if (current == null) {
if (isWindows()) {
current = new WindowsPlatform();
} else {
current = new UnixPlatform();
}
}
return current;
}
protected OSPlatform() {
}
public static boolean isWindows() {
return System.getProperty("os.name").toLowerCase().startsWith("windows");
}
abstract public String cmdInstruction(String cmd);
}