kOS.Safe.Persistence.Volume.Delete C# (CSharp) Method

Delete() public abstract method

public abstract Delete ( VolumePath path, bool ksmDefault = false ) : bool
path VolumePath
ksmDefault bool
return bool
        public abstract bool Delete(VolumePath path, bool ksmDefault = false);

Same methods

Volume::Delete ( string pathString, bool ksmDefault = false ) : bool

Usage Example

Example #1
0
        public bool Move(GlobalPath sourcePath, GlobalPath destinationPath)
        {
            if (sourcePath.IsRoot)
            {
                throw new KOSPersistenceException("Can't move root directory: " + sourcePath);
            }

            if (sourcePath.IsParent(destinationPath))
            {
                throw new KOSPersistenceException("Can't move directory to a subdirectory of itself: " + destinationPath);
            }

            Volume sourceVolume      = GetVolumeFromPath(sourcePath);
            Volume destinationVolume = GetVolumeFromPath(destinationPath);

            bool verifyFreeSpace = sourceVolume != destinationVolume;

            if (!Copy(sourcePath, destinationPath, verifyFreeSpace))
            {
                return(false);
            }

            if (!sourceVolume.Delete(sourcePath))
            {
                throw new KOSPersistenceException("Can't remove: " + sourcePath);
            }

            return(true);
        }