Class PlatformRootConfinement
Keeps what a platform starts under its platform root: a platform starts only its own executables, whatever path its manifest, or an extension's, names.
public static class PlatformRootConfinement
- Inheritance
-
PlatformRootConfinement
- Inherited Members
Remarks
A path is where the system finds it, its real path: each folder on the way, and the file, that is a link (a symbolic link, a junction) is taken where it leads. A path is checked, and started, as that real path, so what is started is what was checked.
Methods
Confined(string, string, string?)
The real path of executable, when it is under platformRoot, or under
ownFolder.
public static string Confined(string platformRoot, string executable, string? ownFolder = null)
Parameters
platformRootstringThe platform root.
executablestringThe full path of the executable the platform is to start.
ownFolderstringThe folder of the starting process's own assemblies (BaseDirectory), when what it starts there is its own: the process runs that folder's code already, and its executables are its own whatever the platform root is said to be (
rdcstartingrdc, its external host).
Returns
Exceptions
- InvalidDataException
executableis not underplatformRoot(norownFolder), or a link on the way to it leads nowhere the system can follow.
IsUnder(string, string)
Whether path is under platformRoot, both as their real paths.
public static bool IsUnder(string platformRoot, string path)
Parameters
platformRootstringThe platform root.
pathstringA full path, or one relative to the working directory.
Returns
Exceptions
- IOException
A link on the way to either leads nowhere the system can follow: a cycle, or more than 40 links.
- UnauthorizedAccessException
A link on the way to either can't be read.
RealPath(string)
The full path of path where the system finds it, with no link on the way: each folder, and the file, that is a link is where it leads.
public static string RealPath(string path)
Parameters
pathstringA full path, or one relative to the working directory.
Returns
Remarks
.. is taken as the system takes it. Windows folds it into the path first (GetFullPath(string)), and Linked.. is the
folder Linked is in. Elsewhere the kernel takes it where the path is so far, and Linked/.. is the folder Linked's target is in.
Exceptions
- IOException
A link on the way leads nowhere the system can follow: a cycle, or more than 40 links.
- UnauthorizedAccessException
A link on the way can't be read.