Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensures temp directory exist before writing to it #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion fspy_blender/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,12 @@ def set_up_3d_area(self, project, camera, update_existing_camera, set_background
# only show the background image when looking through the camera (< 2.8)
bg.view_axis = 'CAMERA'

# Write project image data to a temp file
# Create a temp directory
tmp_dir = bpy.app.tempdir
if not os.path.exists(tmp_dir):
os.makedirs(tmp_dir)

# Write project image data to a temp file
tmp_filename = "fspy-temp-image-" + uuid.uuid4().hex
tmp_path = os.path.join(tmp_dir, tmp_filename)
tmp_file = open(tmp_path, 'wb')
Expand Down