Skip to content

Commit

Permalink
Merge pull request #317 from jiogao/master
Browse files Browse the repository at this point in the history
File path length limit
  • Loading branch information
liiir1985 authored Mar 12, 2020
2 parents e0a424a + ec95952 commit 2c10dea
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions ILRuntime/Runtime/CLRBinding/BindingCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,21 @@ public static void GenerateBindingCode(ILRuntime.Runtime.Enviorment.AppDomain do
if (clsNames.Contains(clsName))
clsName = clsName + "_t";
clsNames.Add(clsName);

string oFileName = outputPath + "/" + clsName;
int len = Math.Min(oFileName.Length, 100);
if (len < oFileName.Length)
oFileName = oFileName.Substring(0, len) + "_t";

//File path length limit
string oriFileName = outputPath + "/" + clsName;
int len = Math.Min(oriFileName.Length, 100);
if (len < oriFileName.Length)
oriFileName = oriFileName.Substring(0, len);

int extraNameIndex = 0;
string oFileName = oriFileName + "_t" + extraNameIndex;
while (files.Contains(oFileName))
oFileName = oFileName + "_t";
{
extraNameIndex++;
oFileName = oriFileName + "_t" + extraNameIndex;
}

files.Add(oFileName);
oFileName = oFileName + ".cs";
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(oFileName, false, new UTF8Encoding(false)))
Expand Down

0 comments on commit 2c10dea

Please sign in to comment.