Skip to content

Commit fa8eb19

Browse files
authored
Merge pull request #132 from EverseDevelopment/86b7az61r/IllegalCharactersPath
Fix Illegal Characters
2 parents 9167e9f + 957650e commit fa8eb19

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

Common_glTF_Exporter/Utils/RevitIniReader.cs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,26 @@ public static List<string> GetAdditionalRenderAppearancePaths()
3939

4040
foreach (var p in paths)
4141
{
42-
string trimmedPath = p.Trim();
42+
string cleanedPath = p.Trim().Trim('"');
4343

44-
// If already rooted, normalize it
45-
if (Path.IsPathRooted(trimmedPath))
46-
{
47-
absolutePaths.Add(Path.GetFullPath(trimmedPath));
48-
}
49-
else
44+
// Replace | with ; or split further if needed
45+
cleanedPath = cleanedPath.Replace('|', ';');
46+
47+
foreach (var subPath in cleanedPath.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
5048
{
51-
// Combine with user profile to resolve relative path
52-
string fullPath = Path.GetFullPath(Path.Combine(userProfile, trimmedPath));
49+
string trimmedPath = subPath.Trim().Trim('"');
50+
51+
if (Path.GetInvalidPathChars().Any(c => trimmedPath.Contains(c)))
52+
{
53+
// Skip or log invalid path
54+
Console.WriteLine($"Skipping invalid path: {trimmedPath}");
55+
continue;
56+
}
57+
58+
string fullPath = Path.IsPathRooted(trimmedPath)
59+
? Path.GetFullPath(trimmedPath)
60+
: Path.GetFullPath(Path.Combine(userProfile, trimmedPath));
61+
5362
absolutePaths.Add(fullPath);
5463
}
5564
}

Common_glTF_Exporter/Windows/ErrorWindow.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363
</TextBlock>
6464

6565
<StackPanel Orientation="Horizontal"
66-
VerticalAlignment="Bottom">
66+
VerticalAlignment="Bottom"
67+
HorizontalAlignment="Center"
68+
Margin="0,0,0,15">
6769
<Button Content="Report Error"
6870
Style="{DynamicResource MainButtonStyle}"
6971
Background="Transparent"

0 commit comments

Comments
 (0)