Path.Combine(string, string)

切换到手册

描述

连接两个路径字符串。

如果 path1 不是以有效的分隔符结束,则 DirectorySeparatorChar 会在连接前附加到 path1。

using System.IO;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { Debug.Log(Path.Combine("/First/Path/To", "Some/File/At/foo.txt")); } }