mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 10:42:58 -03:00
Added resources to cx_Freeze setup, and make those resources findable by the app
This commit is contained in:
parent
3f1180c404
commit
8e8ea9c357
2 changed files with 10 additions and 3 deletions
|
@ -37,9 +37,15 @@ def get_resource_path(filename):
|
||||||
if p == 'Linux' and sys.argv and sys.argv[0].startswith('/usr/bin/onionshare'):
|
if p == 'Linux' and sys.argv and sys.argv[0].startswith('/usr/bin/onionshare'):
|
||||||
# OnionShare is installed systemwide in Linux
|
# OnionShare is installed systemwide in Linux
|
||||||
resources_dir = os.path.join(sys.prefix, 'share/onionshare')
|
resources_dir = os.path.join(sys.prefix, 'share/onionshare')
|
||||||
elif getattr(sys, 'frozen', False): # Check if app is "frozen" with pyinstaller
|
elif getattr(sys, 'frozen', False): # Check if app is "frozen" with pyinstaller, cx_Freeze
|
||||||
# https://pythonhosted.org/PyInstaller/#run-time-information
|
# https://pythonhosted.org/PyInstaller/#run-time-information
|
||||||
resources_dir = sys._MEIPASS
|
# http://cx-freeze.readthedocs.io/en/latest/faq.html#using-data-files
|
||||||
|
if p == 'Windows':
|
||||||
|
# Windows is using cx_Freeze
|
||||||
|
resources_dir = os.path.join(os.path.dirname(sys.executable), 'resources')
|
||||||
|
else:
|
||||||
|
# OS X is using PyInstaller
|
||||||
|
resources_dir = sys._MEIPASS
|
||||||
else: # Look for resources directory relative to python file
|
else: # Look for resources directory relative to python file
|
||||||
resources_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))), 'resources')
|
resources_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))), 'resources')
|
||||||
|
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -86,7 +86,8 @@ if os == 'Windows':
|
||||||
options={
|
options={
|
||||||
"build_exe": {
|
"build_exe": {
|
||||||
"packages": [],
|
"packages": [],
|
||||||
"excludes": []
|
"excludes": [],
|
||||||
|
"include_files": ['resources']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
executables=[
|
executables=[
|
||||||
|
|
Loading…
Add table
Reference in a new issue