Fix FileName

This commit is contained in:
Perfare 2017-03-31 16:41:36 +08:00
parent 60cc81b2dd
commit 86843f81da
2 changed files with 10 additions and 2 deletions

View File

@ -365,6 +365,7 @@ namespace Unity_Studio
{
asset.Text += " #" + asset.uniqueID;
}
asset.Text = FixFileName(asset.Text);
assetsFile.exportableAssets.Add(asset);
}
ProgressBarPerformStep();
@ -1853,5 +1854,11 @@ namespace Unity_Studio
Directory.CreateDirectory(Path.GetDirectoryName(filename));
return false;
}
private static string FixFileName(string str)
{
if (str.Length >= 260) return Path.GetRandomFileName();
return Path.GetInvalidFileNameChars().Aggregate(str, (current, c) => current.Replace(c, '_'));
}
}
}

View File

@ -73,8 +73,9 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="ManagedFbx">
<HintPath>library\ManagedFbx.dll</HintPath>
<Reference Include="ManagedFbx, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>library\x64\ManagedFbx.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>