mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix #6038. Standardardise passing around as_posix() paths
This commit is contained in:
@@ -906,7 +906,7 @@ class LoadProject(bpy.types.Operator, IFCFileSelector):
|
||||
if not filepath:
|
||||
return tooltip
|
||||
filepath = Path(filepath)
|
||||
tooltip += f".\n"
|
||||
tooltip += ".\n"
|
||||
if not filepath.exists():
|
||||
tooltip += "\nFile does not exist"
|
||||
return tooltip
|
||||
@@ -977,7 +977,7 @@ class LoadProject(bpy.types.Operator, IFCFileSelector):
|
||||
bpy.ops.bim.convert_to_blender()
|
||||
|
||||
context.scene.BIMProperties.ifc_file = filepath
|
||||
if not (ifc_file := tool.Ifc.get()):
|
||||
if not tool.Ifc.get():
|
||||
self.report(
|
||||
{"ERROR"},
|
||||
f"Error loading IFC file from filepath '{filepath}'. See logs above in the system console for the details.",
|
||||
@@ -1593,6 +1593,7 @@ class ExportIFC(bpy.types.Operator):
|
||||
output_file = bpy.path.ensure_ext(self.filepath, ".ifcjson")
|
||||
else:
|
||||
output_file = bpy.path.ensure_ext(self.filepath, ".ifc")
|
||||
output_file = Path(output_file).as_posix().replace("\\", "/")
|
||||
|
||||
settings = export_ifc.IfcExportSettings.factory(context, output_file, logger)
|
||||
settings.json_version = self.json_version
|
||||
@@ -1612,7 +1613,7 @@ class ExportIFC(bpy.types.Operator):
|
||||
new.name = output_file
|
||||
if context.scene.BIMProjectProperties.use_relative_project_path and bpy.data.is_saved:
|
||||
output_file = os.path.relpath(output_file, bpy.path.abspath("//"))
|
||||
if scene.BIMProperties.ifc_file != output_file and extension not in ["ifczip", "ifcjson"]:
|
||||
if scene.BIMProperties.ifc_file != output_file and extension not in ("ifczip", "ifcjson"):
|
||||
scene.BIMProperties.ifc_file = output_file
|
||||
save_blend_file = bool(bpy.data.is_saved and bpy.data.is_dirty and bpy.data.filepath)
|
||||
if save_blend_file:
|
||||
|
||||
@@ -66,7 +66,7 @@ class IFCFileSelector:
|
||||
|
||||
if self.use_relative_path:
|
||||
filepath = filepath.relative_to(bpy.path.abspath("//"))
|
||||
return filepath.as_posix()
|
||||
return filepath.as_posix().replace("\\", "/")
|
||||
|
||||
def draw(self, context: bpy.types.Context) -> None:
|
||||
assert isinstance(context.space_data, bpy.types.SpaceFileBrowser)
|
||||
|
||||
@@ -869,7 +869,7 @@ class Blender(bonsai.core.tool.Blender):
|
||||
cls.open_file_or_folder(filepath.as_posix())
|
||||
return {"PASS_THROUGH"}
|
||||
|
||||
# holding sHIFT - open file
|
||||
# holding SHIFT - open file
|
||||
if not filepath.exists():
|
||||
operator.report({"ERROR"}, f'Cannot open non-existing file: "{filepath.as_posix()}"')
|
||||
return {"CANCELLED"}
|
||||
|
||||
Reference in New Issue
Block a user