Add back a deprecated PathValidater.isValid method for public API

This commit is contained in:
William Schaefer 2018-08-15 10:08:42 -04:00
parent 90ef414a17
commit 2f105eaf2d

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2013-2014 Basis Technology Corp.
* Copyright 2013-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* 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 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) {
if (caseType == Case.CaseType.MULTI_USER_CASE) {
@ -41,18 +49,18 @@ public final class PathValidator {
}
} else {
// single user case - no validation needed
}
}
return true;
}
public static boolean isValidForRunningOnTarget(String path) {
if(checkForLiveAutopsy()) {
if(PlatformUtil.isWindowsOS()) {
if(pathOnCDrive(path)){
if (checkForLiveAutopsy()) {
if (PlatformUtil.isWindowsOS()) {
if (pathOnCDrive(path)) {
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;
}
}
@ -91,4 +99,20 @@ public final class PathValidator {
Matcher m = driveLetterPattern.matcher(filePath);
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);
}
}