Skip to content

Commit

Permalink
Fixed runtime issue due to incorrect IfcXML schema file path
Browse files Browse the repository at this point in the history
  • Loading branch information
Wawan Solihin committed Aug 12, 2019
1 parent 30e099f commit a0f484a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions Source/Revit.IFC.Common/Utility/IfcSchemaEntityTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,23 @@ public static IDictionary<string, IfcSchemaEntityNode> GetEntityDictFor(string s
if (string.IsNullOrEmpty(loadedIfcSchemaVersion) || !loadedIfcSchemaVersion.Equals(schemaFile, StringComparison.InvariantCultureIgnoreCase))
{
// Process IFCXml schema here, then search for IfcProduct and build TreeView beginning from that node. Allow checks for the tree nodes. Grey out (and Italic) the abstract entity
schemaFile = Path.Combine(DirectoryUtil.RevitProgramPath, "EDM\\" + schemaFile);
FileInfo schemaFileInfo = new FileInfo(schemaFile);
string schemaFilePath = Path.Combine(DirectoryUtil.RevitProgramPath, "EDM\\" + schemaFile);
FileInfo schemaFileInfo = new FileInfo(schemaFilePath);
#if IFC_OPENSOURCE
if (!schemaFileInfo.Exists)
{
// For the open source code, if the schema file is not found, search also from the IfcExporter install folder
string schemaLoc = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location);
schemaFile = Path.Combine(schemaLoc, schemaFile);
schemaFileInfo = new FileInfo(schemaFile);
string schemaLoc = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location);
schemaFilePath = Path.Combine(schemaLoc, schemaFile);
schemaFileInfo = new FileInfo(schemaFilePath);
}
#endif
if (schemaFileInfo.Exists)
{
bool newLoad = ProcessIFCXMLSchema.ProcessIFCSchema(schemaFileInfo);
if (newLoad)
loadedIfcSchemaVersion = Path.GetFileName(schemaFile);
}
bool newLoad = ProcessIFCXMLSchema.ProcessIFCSchema(schemaFileInfo);
if (newLoad)
loadedIfcSchemaVersion = Path.GetFileName(schemaFile);
}
}

return EntityDict;
Expand Down
2 changes: 1 addition & 1 deletion Source/Revit.IFC.Export/Exporter/Exporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ private string LocateSchemaFile(string schemaFileName)
string filePath = null;
#if IFC_OPENSOURCE
// Find the alternate schema file from the open source install folder
filePath = Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location), schemaFileName);
filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location), schemaFileName);
if (!File.Exists(filePath))
#endif
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Revit.IFC.Export/Exporter/IFCEntityAndPsetList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class IFCEntityAndPsetListRawFromJson
/// </summary>
public IFCCertifiedEntitiesAndPSets()
{
string fileLoc = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location);
string fileLoc = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location);
string filePath = Path.Combine(fileLoc, "IFCCertifiedEntitiesAndPSets.json");

if (File.Exists(filePath))
Expand Down

0 comments on commit a0f484a

Please sign in to comment.