示例#1
0
        public bool Rename(string filePath, string newName)
        {
            var parentDirectory = _pathService.GetParentDirectory(filePath);
            var newFilePath     = _pathService.Combine(parentDirectory, newName);

            try
            {
                _environmentFileService.Move(filePath, newFilePath);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        public bool Rename(string filePath, string newName)
        {
            var parentDirectory = _pathService.GetParentDirectory(filePath);
            var newFilePath     = _pathService.Combine(parentDirectory, newName);

            try
            {
                _environmentFileService.Move(filePath, newFilePath);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to rename file {filePath} to {newName} with error {ex}");

                return(false);
            }

            return(true);
        }
示例#3
0
 public void Move(string oldFilePath, string newFilePath) => _environmentFileService.Move(oldFilePath, newFilePath);