mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-06 01:08:25 +01:00
introduced FileUtils.getLinuxPathFrom: replaces backslashes with slashes
This commit is contained in:
parent
67cb6047de
commit
6a1cdcdd03
@ -5,16 +5,17 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class FileUtils {
|
||||
|
||||
private static final Pattern BACKSLASH = Pattern.compile("\\\\");
|
||||
|
||||
/**
|
||||
* Checks, whether the child directory is a subdirectory of the base directory.
|
||||
*
|
||||
* @param base
|
||||
* the base directory.
|
||||
* @param child
|
||||
* the suspected child directory.
|
||||
* @param base the base directory.
|
||||
* @param child the suspected child directory.
|
||||
* @return true, if the child is a subdirectory of the base directory.
|
||||
*/
|
||||
public static boolean isSubDirectory(File base, File child) {
|
||||
@ -158,4 +159,8 @@ public class FileUtils {
|
||||
|
||||
return relative + target.substring(origin.length() + 1);
|
||||
}
|
||||
|
||||
public static String getLinuxPathFrom(File file) {
|
||||
return BACKSLASH.matcher(file.getAbsolutePath()).replaceAll("/");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user