Example #1
0
        private async Task PromoteNewerPackage(string unpackdPath)
        {
            var success = await _file.Move(unpackdPath, TargetPath);

            if (!success)
            {
                throw Fault.CantMove(unpackdPath, TargetPath);
            }
        }
Example #2
0
        private async Task <bool> RetireCurrentPackage(bool useSystemRetirementDir)
        {
            var retirement = useSystemRetirementDir ? _file.GetTempFilePath()
                                                    : TargetPath + ".retired";
            var success = await _file.Move(TargetPath, retirement);

            if (!success)
            {
                throw Fault.CantMove(TargetPath, retirement);
            }

            if (_file.Found(TargetPath))
            {
                SetStatus($"Failed to retire current package to ā€œ{Path.GetPathRoot(retirement)}ā€.");
                return(false);
            }
            return(true);
        }