1fafd898cbead872bfc536904688d68ec5492773
1 package com
.owncloud
.android
.oc_framework
.utils
;
5 import android
.util
.Log
;
7 public class FileUtils
{
9 public static final String PATH_SEPARATOR
= "/";
12 public static String
getParentPath(String remotePath
) {
13 String parentPath
= new File(remotePath
).getParent();
14 parentPath
= parentPath
.endsWith(PATH_SEPARATOR
) ? parentPath
: parentPath
+ PATH_SEPARATOR
;
19 * Validate the fileName to detect if contains any forbidden character: / , \ , < , > , : , " , | , ? , *
23 public static boolean validateName(String fileName
) {
24 boolean result
= true
;
26 Log
.d("FileUtils", "fileName =======" + fileName
);
27 String name
= fileName
.substring(1);
28 if ((fileName
.indexOf("/") > 0 && name
.indexOf("/") < (name
.length() - 1 ) ) ||
29 fileName
.contains("\\") || fileName
.contains("<") || fileName
.contains(">") ||
30 fileName
.contains(":") || fileName
.contains("\"") || fileName
.contains("|") ||
31 fileName
.contains("?") || fileName
.contains("*")) {