diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceUtil.cs b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceUtil.cs index 7f3464170..8a35b2593 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceUtil.cs +++ b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceUtil.cs @@ -90,7 +90,15 @@ private static string PathToResourceAsFile(string assetPath) Logger.LogDebug(_TAG, $"{assetPath} is requested"); if (TryGetFilePath(assetPath, out var filePath)) { - return filePath; + if (PathHasNonAsciiChars(filePath)) + { + string tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetFileName(filePath)); + File.Copy(filePath, tempFilePath, true); + Logger.LogDebug(_TAG, $"Path {filePath} contains non-ASCII characters. Copied to temp file path: {tempFilePath}"); + return tempFilePath; + } + else + return filePath; } throw new KeyNotFoundException($"Failed to find the file path for `{assetPath}`"); } @@ -151,5 +159,18 @@ private static string GetAssetNameFromPath(string assetPath) } } } + + private static bool PathHasNonAsciiChars(string path) + { + foreach (var c in path) + { + if (c > 127) + { + return true; + } + } + + return false; + } } }