AGS.Editor.AGSEditor.IsEnoughSpaceFreeOnDisk C# (CSharp) Method

IsEnoughSpaceFreeOnDisk() private method

private IsEnoughSpaceFreeOnDisk ( long spaceRequired ) : bool
spaceRequired long
return bool
        private bool IsEnoughSpaceFreeOnDisk(long spaceRequired)
        {
            string gameRoot = Path.GetPathRoot(_game.DirectoryPath).ToUpper();
            if (gameRoot.StartsWith(@"\\"))
            {
                // network share, we can't check free space
                return true;
            }
            foreach (DriveInfo drive in DriveInfo.GetDrives())
            {
                if (drive.RootDirectory.Name.ToUpper() == gameRoot)
                {
                    if (drive.AvailableFreeSpace < spaceRequired)
                    {
                        return false;
                    }
                    return true;
                }
            }
            throw new AGSEditorException("Unable to find drive for game path: " + _game.DirectoryPath);
        }