forked from Kazuhito00/Image-Processing-Node-Editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhook-runtime-cv-studio.py
More file actions
27 lines (22 loc) · 949 Bytes
/
hook-runtime-cv-studio.py
File metadata and controls
27 lines (22 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Runtime hook for CV_Studio PyInstaller build
This hook ensures that the application directories are properly added to
sys.path at runtime, allowing proper module imports from the _internal directory.
"""
import sys
import os
# Get the directory where the executable is located
if getattr(sys, 'frozen', False):
# Running in a PyInstaller bundle
bundle_dir = sys._MEIPASS
# Add the bundle directory to sys.path if not already there
if bundle_dir not in sys.path:
sys.path.insert(0, bundle_dir)
# Ensure that node, node_editor, and src directories are accessible
# Add in reverse order so they end up in the correct priority
for subdir in reversed(['node', 'node_editor', 'src']):
subdir_path = os.path.join(bundle_dir, subdir)
if os.path.exists(subdir_path) and subdir_path not in sys.path:
sys.path.insert(0, subdir_path)