Skip to content

Commit

Permalink
fix: in Unity 2018.x, sample import failed on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mob-sakai committed Sep 27, 2020
1 parent 72de97b commit 207ea9c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Packages/SoftMaskForUGUI/Scripts/Editor/ImportSampleMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ private static void ImportTextMeshProSupport()
private static void ImportSample(string jsonGuid, string sampleName)
{
var jsonPath = AssetDatabase.GUIDToAssetPath(jsonGuid);
var packageRoot = Path.GetDirectoryName(jsonPath).Replace('\\', '/');
var json = File.ReadAllText(jsonPath);
var version = Regex.Match(json, "\"version\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value;
var displayName = Regex.Match(json, "\"displayName\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value;
var src = string.Format("{0}/Samples~/{1}", Path.GetDirectoryName(jsonPath), sampleName);
var srcAlt = string.Format("{0}/Samples/{1}", Path.GetDirectoryName(jsonPath), sampleName);
var src = string.Format("{0}/Samples~/{1}", packageRoot, sampleName);
var srcAlt = string.Format("{0}/Samples/{1}", packageRoot, sampleName);
var dst = string.Format("Assets/Samples/{0}/{1}/{2}", displayName, version, sampleName);
var previousPath = GetPreviousSamplePath(displayName, sampleName);

Expand Down

0 comments on commit 207ea9c

Please sign in to comment.