192c267b1ed4fa967438c7541e4a15e5169bd733
1 /* ownCloud Android client application
2 * Copyright (C) 2012-2013 ownCloud Inc.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package com
.owncloud
.android
.oc_framework
.utils
;
22 import android
.util
.Log
;
24 public class FileUtils
{
26 public static final String PATH_SEPARATOR
= "/";
29 public static String
getParentPath(String remotePath
) {
30 String parentPath
= new File(remotePath
).getParent();
31 parentPath
= parentPath
.endsWith(PATH_SEPARATOR
) ? parentPath
: parentPath
+ PATH_SEPARATOR
;
36 * Validate the fileName to detect if contains any forbidden character: / , \ , < , > , : , " , | , ? , *
40 public static boolean isValidName(String fileName
) {
41 boolean result
= true
;
43 Log
.d("FileUtils", "fileName =======" + fileName
);
44 if (fileName
.contains(PATH_SEPARATOR
) ||
45 fileName
.contains("\\") || fileName
.contains("<") || fileName
.contains(">") ||
46 fileName
.contains(":") || fileName
.contains("\"") || fileName
.contains("|") ||
47 fileName
.contains("?") || fileName
.contains("*")) {
54 * Validate the path to detect if contains any forbidden character: \ , < , > , : , " , | , ? , *
58 public static boolean isValidPath(String path
) {
59 boolean result
= true
;
61 Log
.d("FileUtils", "path ....... " + path
);
62 if (path
.contains("\\") || path
.contains("<") || path
.contains(">") ||
63 path
.contains(":") || path
.contains("\"") || path
.contains("|") ||
64 path
.contains("?") || path
.contains("*")) {