We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bac683e commit 47cc315Copy full SHA for 47cc315
1 file changed
src/ifcpatch/ifcpatch/__init__.py
@@ -18,9 +18,9 @@
18
# You should have received a copy of the GNU Lesser General Public License
19
# along with IfcPatch. If not, see <http://www.gnu.org/licenses/>.
20
21
+import os
22
import ifcopenshell
23
import logging
-import os
24
import typing
25
import inspect
26
import collections
@@ -95,9 +95,14 @@ def write(output, filepath):
95
:return: None
96
:rtype: None
97
"""
98
- if isinstance(output, str):
99
- with open(filepath, "w") as text_file:
100
- text_file.write(output)
+ if output is None:
+ return
+ elif isinstance(output, str):
101
+ if os.path.exists(output):
102
+ os.rename(output, filepath)
103
+ else:
104
+ with open(filepath, "w") as text_file:
105
+ text_file.write(output)
106
else:
107
output.write(filepath)
108
0 commit comments