mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* 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.
24 lines
771 B
C#
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;
|
|
}
|
|
}
|
|
}
|