mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-08 22:29:33 +00:00
Merge pull request #4044 from wschaeferB/AddPathValidatorIsValid
Add back a deprecated PathValidater.isValid method for public API
This commit is contained in:
commit
418e202079
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2013-2014 Basis Technology Corp.
|
* Copyright 2013-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -32,6 +32,14 @@ public final class PathValidator {
|
|||||||
private static final Pattern driveLetterPattern = Pattern.compile("^[Cc]:.*$");
|
private static final Pattern driveLetterPattern = Pattern.compile("^[Cc]:.*$");
|
||||||
private static final Pattern unixMediaDrivePattern = Pattern.compile("^\\/(media|mnt)\\/.*$");
|
private static final Pattern unixMediaDrivePattern = Pattern.compile("^\\/(media|mnt)\\/.*$");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the provided path is valid given the case type.
|
||||||
|
*
|
||||||
|
* @param path - the path to validate
|
||||||
|
* @param caseType - the type of case which the path is being validated for
|
||||||
|
*
|
||||||
|
* @return - boolean true for valid path, false for invalid path
|
||||||
|
*/
|
||||||
public static boolean isValidForMultiUserCase(String path, Case.CaseType caseType) {
|
public static boolean isValidForMultiUserCase(String path, Case.CaseType caseType) {
|
||||||
|
|
||||||
if (caseType == Case.CaseType.MULTI_USER_CASE) {
|
if (caseType == Case.CaseType.MULTI_USER_CASE) {
|
||||||
@ -47,12 +55,12 @@ public final class PathValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidForRunningOnTarget(String path) {
|
public static boolean isValidForRunningOnTarget(String path) {
|
||||||
if(checkForLiveAutopsy()) {
|
if (checkForLiveAutopsy()) {
|
||||||
if(PlatformUtil.isWindowsOS()) {
|
if (PlatformUtil.isWindowsOS()) {
|
||||||
if(pathOnCDrive(path)){
|
if (pathOnCDrive(path)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else if(System.getProperty("os.name").toLowerCase().contains("nux") && !pathIsMedia(path)){
|
} else if (System.getProperty("os.name").toLowerCase().contains("nux") && !pathIsMedia(path)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,4 +99,20 @@ public final class PathValidator {
|
|||||||
Matcher m = driveLetterPattern.matcher(filePath);
|
Matcher m = driveLetterPattern.matcher(filePath);
|
||||||
return m.find();
|
return m.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the provided path is valid given the case type.
|
||||||
|
*
|
||||||
|
* @param path - the path to validate
|
||||||
|
* @param caseType - the type of case which the path is being validated for
|
||||||
|
*
|
||||||
|
* @return - boolean true for valid path, false for invalid path
|
||||||
|
*
|
||||||
|
* @deprecated - PathValidator.isValidForMultiUserCase directly replaces
|
||||||
|
* PathValidator.isValid
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static boolean isValid(String path, Case.CaseType caseType) {
|
||||||
|
return isValidForMultiUserCase(path, caseType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user