Files
RobustToolbox/SS14.Shared/Utility/PlatformTools.cs
Acruid 3d128747c4 VFS Features (#611)
* Added the new writable VFS API. Resolves #566.

* Moved resource interfaces into the new Interfaces.Resource namespace.

* Adds the property `ResourcePath.Directory`.
Removes the obsolete property `IResourceManager.ConfigDirectory`.

* Marked string version of content functions as obsolete.

* Removed unused `System.IO` using statements.

* Removed the System.IO namespace from a bunch of files.
Made the string version of IResourceCache obsolete, and converted everything to use the ResourcePath versions.
This should Resolve #567.

* Fixing some bugs.

* Un-Obsolete the string functions in IResourceCache and IResourceManager.
2018-07-02 20:33:14 +02:00

24 lines
771 B
C#

using System;
using System.IO;
namespace SS14.Shared.Utility
{
public class PlatformTools
{
public static string SanePath(String pathname)
{
// sanitize the pathname in config.xml for the current OS
// N.B.: You cannot use Path.DirectorySeparatorChar and
// Path.AltDirectorySeparatorChar here, because on some platforms
// they are the same. Mono/linux has both as '/', for example.
// Hardcode the only platforms we care about.
var separators = new char[] { '/', '\\' };
string newpath = "";
foreach (string tmp in pathname.Split(separators))
newpath = Path.Combine(newpath, tmp);
return newpath;
}
}
}