2021-05-07 17:06:56 +10:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace UnityExplorer
|
|
|
|
|
{
|
|
|
|
|
public static class IOUtility
|
|
|
|
|
{
|
2021-05-14 02:45:59 +10:00
|
|
|
|
private static readonly char[] invalidDirectoryCharacters = Path.GetInvalidPathChars();
|
|
|
|
|
private static readonly char[] invalidFilenameCharacters = Path.GetInvalidFileNameChars();
|
2021-05-07 17:06:56 +10:00
|
|
|
|
|
2021-05-14 02:45:59 +10:00
|
|
|
|
public static string EnsureValidDirectory(string path)
|
|
|
|
|
{
|
|
|
|
|
return string.Concat(path.Split(invalidDirectoryCharacters));
|
2021-05-07 17:06:56 +10:00
|
|
|
|
}
|
|
|
|
|
|
2021-05-14 02:45:59 +10:00
|
|
|
|
public static string EnsureValidFilename(string filename)
|
2021-05-07 17:06:56 +10:00
|
|
|
|
{
|
2021-05-14 02:45:59 +10:00
|
|
|
|
return string.Concat(filename.Split(invalidFilenameCharacters));
|
2021-05-07 17:06:56 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|