public static SanitizeName ( string folder ) : string | ||
folder | string | |
return | string |
public static string SanitizeName(string folder) {
int match = folder.IndexOfAny(Path.GetInvalidPathChars());
if (match != -1) {
folder = folder.Replace(folder[match], '_');
return SanitizeName(folder);
}
match = folder.IndexOfAny(Path.GetInvalidFileNameChars());
if (match != -1) {
folder = folder.Replace(folder[match], '_');
return SanitizeName(folder);
}
return folder;
}