AddPathSlash
public static string AddPathSlash(
string input
)
| Parameter | Type | Default | Description |
|---|---|---|---|
| input | string | The input string |
Returns: The string with a slash added at the end if there was no slash
Add a slash to the end of a string if there is no slash. Useful to sanitize path inputs.
Example Usage
using UnityEngine;
using MikeDaBird.EZRecolor.Utilities.Editor;
class GeneratePath : MonoBehavior{
public string fileName = "MyTexture";
public string path = "FinalFolder";
// Generate a file path from a path and file name
public string MakePath(){
string filePath = EZRecolorBaker.AddPathSlash(path) + fileName + ".png";
return filePath;
// This will return the following:
// "FinalFolder/MyTexture.png"
}
}