Created
August 28, 2018 09:11
-
-
Save nkjzm/d0c5fcf48627d6d8fa3f30b656f0242f to your computer and use it in GitHub Desktop.
System.IO.Path.DirectorySeparatorCharの値をリフレクションで書き換える方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.IO; | |
using System.Reflection; | |
[InitializeOnLoad] | |
public class PathReplacer | |
{ | |
static PathReplacer() | |
{ | |
typeof(Path).GetField("DirectorySeparatorChar", BindingFlags.Static | BindingFlags.Public).SetValue(null, '/'); | |
Debug.Log(Path.DirectorySeparatorChar); // Output=> \ | |
System.Func<char> getValue = () => Path.DirectorySeparatorChar; | |
Debug.Log(getValue()); // Output=> / | |
Debug.Log(Path.Combine("A", "B")); // Output=> A\B | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
教えていただきました~~