All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
28 lines
723 B
Java
28 lines
723 B
Java
package tech.bitgoblin.io;
|
|
|
|
import java.io.File;
|
|
|
|
public class IOUtils {
|
|
|
|
public static void createDirectory(String path) {
|
|
File f = new File(path);
|
|
boolean res = f.mkdir();
|
|
|
|
if (res) {
|
|
System.out.println(path + " was created.");
|
|
}
|
|
}
|
|
|
|
public static String resolveTilda(String path) {
|
|
if (path.startsWith("~" + File.separator) || path.equals("~")) {
|
|
path = System.getProperty("user.home") + path.substring(1);
|
|
} else if ((!path.equals("~")) && path.startsWith("~")) {
|
|
// here you can implement reading homedir of other users if you care
|
|
throw new UnsupportedOperationException("Home dir expansion not implemented for explicit usernames");
|
|
}
|
|
|
|
return path;
|
|
}
|
|
|
|
}
|