mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-25 17:00:35 +05:00
Avoid creation of tmp files in HOME
This commit is contained in:
parent
7c90108313
commit
656b91bf45
@ -76,15 +76,25 @@ geompy.addToStudy(Prism_1, "Prism_1")
|
|||||||
|
|
||||||
#Save Study (9.1)
|
#Save Study (9.1)
|
||||||
theHomePath = os.path.expanduser("~")
|
theHomePath = os.path.expanduser("~")
|
||||||
|
|
||||||
|
# Remove study file if it already exists
|
||||||
theFilenameToSave = theHomePath + "/Pyramid.hdf"
|
theFilenameToSave = theHomePath + "/Pyramid.hdf"
|
||||||
if os.access(theFilenameToSave, os.F_OK):
|
if os.access(theFilenameToSave, os.F_OK):
|
||||||
if os.access(theFilenameToSave, os.W_OK):
|
if os.access(theFilenameToSave, os.W_OK):
|
||||||
os.remove(theFilenameToSave)
|
os.remove(theFilenameToSave)
|
||||||
salome.myStudy.SaveAs(theFilenameToSave, 0, 0)
|
|
||||||
else:
|
else:
|
||||||
print("You have no enough permissions to overwrite HDF file: ",theFilenameToSave)
|
print("You have no enough permissions to overwrite HDF file: ",theFilenameToSave)
|
||||||
else:
|
|
||||||
salome.myStudy.SaveAs(theFilenameToSave, 0, 0)
|
|
||||||
|
|
||||||
|
# Save study
|
||||||
|
salome.myStudy.SaveAs(theFilenameToSave, 0, 0)
|
||||||
|
|
||||||
|
# Check and remove result file
|
||||||
|
if os.access(theFilenameToSave, os.F_OK):
|
||||||
|
if os.access(theFilenameToSave, os.W_OK):
|
||||||
|
os.remove(theFilenameToSave)
|
||||||
|
else:
|
||||||
|
print("You have no enough permissions to delete HDF file: ",theFilenameToSave)
|
||||||
|
else:
|
||||||
|
print("ERROR: Failed to save study in HDF file: ",theFilenameToSave)
|
||||||
|
|
||||||
salome.sg.updateObjBrowser()
|
salome.sg.updateObjBrowser()
|
||||||
|
Loading…
Reference in New Issue
Block a user