Added preliminary .desktop file generation for linux exports.
This commit is contained in:
parent
7444c9582b
commit
3bf1d82ec7
2 changed files with 37 additions and 1 deletions
|
|
@ -698,6 +698,8 @@ class CommandBase(object):
|
|||
dest_binary_path = os.path.join(export_dest,
|
||||
self.project_name() +
|
||||
ext)
|
||||
if 'linux' in ex_setting.name:
|
||||
self.make_desktop_file(dest_binary_path, export_dest)
|
||||
|
||||
join_files(dest_binary_path, nw_path, zip_file)
|
||||
|
||||
|
|
@ -722,6 +724,40 @@ class CommandBase(object):
|
|||
finally:
|
||||
shutil.rmtree(temp_dir)
|
||||
|
||||
def make_desktop_file(self, nw_path, export_dest):
|
||||
icon_set = self.get_setting('icon')
|
||||
icon_path = os.path.join(self.project_dir(), icon_set.value)
|
||||
if os.path.exists(icon_path):
|
||||
shutil.copy(icon_path, export_dest)
|
||||
icon_path = os.path.join(export_dest, os.path.basename(icon_path))
|
||||
else:
|
||||
icon_path = ''
|
||||
name = self.project_name()
|
||||
pdir = self.project_dir()
|
||||
version = self.get_setting('version')
|
||||
desc = self.get_setting('description')
|
||||
dfile_path = os.path.join(export_dest, name+'.desktop')
|
||||
file_str = (
|
||||
'[Desktop Entry]\n'
|
||||
'Version={}\n'
|
||||
'Name={}\n'
|
||||
'Comment={}\n'
|
||||
'Exec={}\n'
|
||||
'Icon={}\n'
|
||||
'Terminal=false\n'
|
||||
'Type=Application\n'
|
||||
'Categories=Utility;Application;\n'
|
||||
)
|
||||
file_str = file_str.format(version.value,
|
||||
name,
|
||||
desc.value,
|
||||
nw_path,
|
||||
icon_path)
|
||||
with open(dfile_path, 'w+') as f:
|
||||
f.write(file_str)
|
||||
|
||||
os.chmod(dfile_path, 0755)
|
||||
|
||||
def compress_nw(self, nw_path):
|
||||
compression = self.get_setting('nw_compression_level')
|
||||
if compression.value == 0:
|
||||
|
|
|
|||
2
main.py
2
main.py
|
|
@ -1,6 +1,6 @@
|
|||
from utils import log, open_folder_in_explorer
|
||||
|
||||
__gui_version__ = "v0.2.2b"
|
||||
__gui_version__ = "v0.2.3b"
|
||||
|
||||
import os
|
||||
import re
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue