Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Owner

@homuler homuler Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we end up implementing a workaround on the C# side, it might make sense to change the _CacheRoot value so that the path contains only ASCII characters, since PathAsResourceFile is not expected to have side effects.

_CachePathRoot = Path.Combine(Application.persistentDataPath, _RelativePath);

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}`");
}
Expand Down Expand Up @@ -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;
}
}
}