X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/d58d6ca4d02233d4a9370104dd3d10bdac7aa4b8..f670cfad8f3d79e3b0fc53bf62b45d8122ecdb77:/src/com/owncloud/android/utils/DisplayUtils.java diff --git a/src/com/owncloud/android/utils/DisplayUtils.java b/src/com/owncloud/android/utils/DisplayUtils.java index cad17706..a1afb894 100644 --- a/src/com/owncloud/android/utils/DisplayUtils.java +++ b/src/com/owncloud/android/utils/DisplayUtils.java @@ -33,6 +33,7 @@ import android.text.format.DateUtils; import com.owncloud.android.MainApp; import com.owncloud.android.R; +import com.owncloud.android.datamodel.OCFile; /** * A helper class for some string operations. @@ -319,4 +320,17 @@ public class DisplayUtils { return dateString.toString().split(",")[0]; } + + /** + * Update the passed path removing the last "/" if it is not the root folder + * @param path + */ + public static String getPathWithoutLastSlash(String path) { + + // Remove last slash from path + if (path.length() > 1 && path.charAt(path.length()-1) == OCFile.PATH_SEPARATOR.charAt(0)) { + path = path.substring(0, path.length()-1); + } + return path; + } }