|
@@ -24,6 +24,15 @@ object FileNameValidator {
|
|
|
"LPT¹", "LPT²", "LPT³"
|
|
|
)
|
|
|
|
|
|
+ /**
|
|
|
+ * Checks the validity of a file name.
|
|
|
+ *
|
|
|
+ * @param filename The name of the file to validate.
|
|
|
+ * @param capability The capabilities affecting the validation criteria such as forbiddenFilenames, forbiddenCharacters.
|
|
|
+ * @param context The context used for retrieving error messages.
|
|
|
+ * @param existedFileNames Set of existing file names to avoid duplicates.
|
|
|
+ * @return An error message if the filename is invalid, null otherwise.
|
|
|
+ */
|
|
|
@Suppress("ReturnCount")
|
|
|
fun checkFileName(
|
|
|
filename: String,
|
|
@@ -63,6 +72,15 @@ object FileNameValidator {
|
|
|
return null
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Checks the validity of file paths wanted to move or copied inside the folder.
|
|
|
+ *
|
|
|
+ * @param folderPath Target folder to be used for move or copy.
|
|
|
+ * @param filePaths The list of file paths to move or copy to folderPath.
|
|
|
+ * @param capability The capabilities affecting the validation criteria.
|
|
|
+ * @param context The context used for retrieving error messages.
|
|
|
+ * @return True if folder path and file paths are valid, false otherwise.
|
|
|
+ */
|
|
|
fun checkFolderAndFilePaths(
|
|
|
folderPath: String,
|
|
|
filePaths: List<String>,
|