Cmis.Utility.CmisPath.WithoutTrailingSlash C# (CSharp) Method

WithoutTrailingSlash() public method

public WithoutTrailingSlash ( ) : CmisPath
return CmisPath
        public CmisPath WithoutTrailingSlash()
        {
            if (!HasTrailingSlash())
            {
                return this;
            }
            return new CmisPath(_path.Remove(_path.Length - 1, 1));
        }

Usage Example

示例#1
0
        public IFolder CreateFolder(CmisPath path, bool recursive,
                                    IDictionary <string, object> properties)
        {
            path = path.WithoutTrailingSlash();

            if (recursive)
            {
                // check if it already exists and proceed to create otherwise
                try
                {
                    return(GetFolder(path));
                }
                catch (CmisObjectNotFoundException)
                {
                }
            }

            var     components = path.GetComponents();
            var     dirname    = components[0];
            var     basename   = components[1];
            IFolder parent     = recursive ? CreateFolder(dirname, true, null) : GetFolder(dirname);

            var allProps = new Dictionary <string, object>()
            {
                { PropertyIds.ObjectTypeId, "cmis:folder" },
                { PropertyIds.Name, basename }
            };

            Utilities.UpdateDictionary(allProps, properties);
            return(parent.CreateFolder(allProps));
        }
All Usage Examples Of Cmis.Utility.CmisPath::WithoutTrailingSlash