Exemple #1
0
        public void SetUnixOwnerIfNeeded(string path, bool applyToAllContents = false)
        {
            if (_vmConfiguration != null && _vmConfiguration.RunContainersInUserMode)
            {
                _logger?.LogVerbose($"Setting unix owner for {path}");
                _fileSystemOperations.SetUnixOwner(path, User);
                if (_fileSystemOperations.IsDirectory(path) && applyToAllContents)
                {
                    DirectoryInfo dirInfo = new DirectoryInfo(path);
                    IEnumerable <FileSystemInfo> childItems = _fileSystemOperations.GetFileSystemInfos(dirInfo, true);

                    foreach (FileSystemInfo child in childItems)
                    {
                        _fileSystemOperations.SetUnixOwner(child.FullName, User);
                    }
                }
            }
        }