You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Add a layer of caching to avoid running msbuild as much as possible. #jira UE-109181 #rb ben.marsh #ROBOMERGE-SOURCE: CL 17102399 in //UE5/Main/... #ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v853-17066230) [CL 17102408 by jonathan adamczewski in ue5-release-engine-test branch]
82 lines
2.5 KiB
C#
82 lines
2.5 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
namespace Microsoft.Build.Shared.FileSystem
|
|
{
|
|
/// <summary>
|
|
/// Implementation of file system operations directly over the dot net managed layer
|
|
/// </summary>
|
|
internal class ManagedFileSystem : IFileSystem
|
|
{
|
|
private static readonly ManagedFileSystem Instance = new ManagedFileSystem();
|
|
|
|
public static ManagedFileSystem Singleton() => ManagedFileSystem.Instance;
|
|
|
|
protected ManagedFileSystem() { }
|
|
|
|
public TextReader ReadFile(string path)
|
|
{
|
|
return new StreamReader(path);
|
|
}
|
|
|
|
public Stream GetFileStream(string path, FileMode mode, FileAccess access, FileShare share)
|
|
{
|
|
return new FileStream(path, mode, access, share);
|
|
}
|
|
|
|
public string ReadFileAllText(string path)
|
|
{
|
|
return File.ReadAllText(path);
|
|
}
|
|
|
|
public byte[] ReadFileAllBytes(string path)
|
|
{
|
|
return File.ReadAllBytes(path);
|
|
}
|
|
|
|
public virtual IEnumerable<string> EnumerateFiles(string path, string searchPattern, SearchOption searchOption)
|
|
{
|
|
return Directory.EnumerateFiles(path, searchPattern, searchOption);
|
|
}
|
|
|
|
public virtual IEnumerable<string> EnumerateDirectories(string path, string searchPattern, SearchOption searchOption)
|
|
{
|
|
return Directory.EnumerateDirectories(path, searchPattern, searchOption);
|
|
}
|
|
|
|
public virtual IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern, SearchOption searchOption)
|
|
{
|
|
return Directory.EnumerateFileSystemEntries(path, searchPattern, searchOption);
|
|
}
|
|
|
|
public FileAttributes GetAttributes(string path)
|
|
{
|
|
return File.GetAttributes(path);
|
|
}
|
|
|
|
public virtual DateTime GetLastWriteTimeUtc(string path)
|
|
{
|
|
return File.GetLastWriteTimeUtc(path);
|
|
}
|
|
|
|
public virtual bool DirectoryExists(string path)
|
|
{
|
|
return Directory.Exists(path);
|
|
}
|
|
|
|
public virtual bool FileExists(string path)
|
|
{
|
|
return File.Exists(path);
|
|
}
|
|
|
|
public virtual bool FileOrDirectoryExists(string path)
|
|
{
|
|
return FileExists(path) || DirectoryExists(path);
|
|
}
|
|
}
|
|
}
|