tgstation-server  4.3.2
The /tg/station 13 server suite
ResolvingIOManager.cs
Go to the documentation of this file.
1 using System;
2 using System.IO;
3 
4 namespace Tgstation.Server.Host.IO
5 {
10  {
14  readonly string subdirectory;
15 
21  public ResolvingIOManager(IIOManager parent, string subdirectory)
22  {
23  if (parent == null)
24  throw new ArgumentNullException(nameof(parent));
25  if (subdirectory == null)
26  throw new ArgumentNullException(nameof(subdirectory));
27 
28  this.subdirectory = ConcatPath(parent.ResolvePath(), subdirectory);
29  }
30 
32  public override string ResolvePath(string path)
33  {
34  if (!Path.IsPathRooted(path))
35  return base.ResolvePath(ConcatPath(subdirectory, path));
36  return path;
37  }
38  }
39 }
An IIOManager that resolve relative paths from another IIOManager to a subdirectory of that ...
ResolvingIOManager(IIOManager parent, string subdirectory)
Construct a ResolvingIOManager
string ResolvePath()
Retrieve the full path of the current working directory.
override string ResolvePath(string path)
Retrieve the full path of some path given a relative path. Must be used before passing relative path...
IIOManager that resolves paths to Environment.CurrentDirectory
Interface for using filesystems
Definition: IIOManager.cs:11
readonly string subdirectory
Path to the subdirectory attached to path resolutions