Created a Java w/ Maven project structure; added a simple directory creation and executes an FFMPEG command to transcode videos
This commit is contained in:
27
src/main/java/tech/bitgoblin/io/IOUtils.java
Normal file
27
src/main/java/tech/bitgoblin/io/IOUtils.java
Normal file
@ -0,0 +1,27 @@
|
||||
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 = System.getProperty("user.home") + path.substring(1);
|
||||
} else if (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;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user