mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
IfcPatch can now support patches that write to arbitrary files or have no output.
This commit is contained in:
@@ -18,9 +18,9 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
|
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import os
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import typing
|
import typing
|
||||||
import inspect
|
import inspect
|
||||||
import collections
|
import collections
|
||||||
@@ -95,9 +95,14 @@ def write(output, filepath):
|
|||||||
:return: None
|
:return: None
|
||||||
:rtype: None
|
:rtype: None
|
||||||
"""
|
"""
|
||||||
if isinstance(output, str):
|
if output is None:
|
||||||
with open(filepath, "w") as text_file:
|
return
|
||||||
text_file.write(output)
|
elif isinstance(output, str):
|
||||||
|
if os.path.exists(output):
|
||||||
|
os.rename(output, filepath)
|
||||||
|
else:
|
||||||
|
with open(filepath, "w") as text_file:
|
||||||
|
text_file.write(output)
|
||||||
else:
|
else:
|
||||||
output.write(filepath)
|
output.write(filepath)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user