Skip to content

Commit 3cc4943

Browse files
author
piotrj
committed
fix sub-exe call
1 parent 64a1326 commit 3cc4943

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/core.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060

6161
is_frozen = bool(getattr(sys, 'frozen', False) or "__compiled__" in globals())
6262

63-
record_exe = ( ('record.exe') if is_frozen else ('python','src\\record.py') ) if windows else ( ('./record') if is_frozen else ('python3','./src/record.py') )
64-
6563
PARAM_INDICATOR_SIGN = '%'
6664

6765
DATA_FORMAT_VERSION='0019'
@@ -1418,9 +1416,10 @@ def unload_customdata(self):
14181416
class LibrerCore:
14191417
records = set()
14201418

1421-
def __init__(self,db_dir,log):
1419+
def __init__(self,db_dir,record_exe,log):
14221420
self.records = set()
14231421
self.db_dir = db_dir
1422+
self.record_exe = record_exe
14241423
self.log=log
14251424
self.info_line = 'init'
14261425

@@ -2318,7 +2317,7 @@ def create_new_record(self,temp_dir,update_callback,group=None):
23182317

23192318
new_file_path = sep.join([self.db_dir,f'rep.{int(time())}.dat'])
23202319

2321-
command = list(record_exe)
2320+
command = list(self.record_exe)
23222321
command.append('create')
23232322
command.append(new_file_path)
23242323
command.append(temp_dir)
@@ -2482,7 +2481,7 @@ def find_items_in_records(self,
24822481
record_command_list={}
24832482

24842483
for record_nr,record in enumerate(records_to_process):
2485-
curr_command_list = record_command_list[record_nr] = list(record_exe)
2484+
curr_command_list = record_command_list[record_nr] = list(self.record_exe)
24862485
curr_command_list.extend(['search',record.file_path,temp_dir])
24872486
self.log.info(f'curr_command_list: {curr_command_list}')
24882487

src/librer.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -4845,11 +4845,26 @@ def show_homepage(self):
48454845
LIBRER_FILE = normpath(__file__)
48464846
LIBRER_DIR = dirname(LIBRER_FILE)
48474847

4848-
LIBRER_EXECUTABLE_FILE = normpath(abspath(sys.executable if getattr(sys, 'frozen', False) or "__compiled__" in globals() else sys.argv[0]))
4848+
is_frozen = bool(getattr(sys, 'frozen', False) or "__compiled__" in globals())
4849+
4850+
LIBRER_EXECUTABLE_FILE = normpath(abspath(sys.executable if is_frozen else sys.argv[0]))
48494851
LIBRER_EXECUTABLE_DIR = dirname(LIBRER_EXECUTABLE_FILE)
48504852
DATA_DIR = sep.join([LIBRER_EXECUTABLE_DIR,'data'])
48514853
LOG_DIR = sep.join([LIBRER_EXECUTABLE_DIR,'logs'])
48524854

4855+
if windows:
4856+
if is_frozen:
4857+
record_exe = [sep.join([LIBRER_EXECUTABLE_DIR,'record.exe']) ]
4858+
else:
4859+
record_exe = ['python',sep.join([LIBRER_EXECUTABLE_DIR,'record.py']) ]
4860+
else:
4861+
if is_frozen:
4862+
record_exe = [sep.join([LIBRER_EXECUTABLE_DIR,'record']) ]
4863+
else:
4864+
record_exe = ['python3',sep.join([LIBRER_EXECUTABLE_DIR,'record.py']) ]
4865+
4866+
#print(f'{is_frozen=}\n{record_exe=}\n')
4867+
48534868
#######################################################################
48544869

48554870
VER_TIMESTAMP = get_ver_timestamp()
@@ -4875,7 +4890,7 @@ def show_homepage(self):
48754890
else:
48764891
l_info('distro info:\n%s',distro_info)
48774892

4878-
librer_core = LibrerCore(DATA_DIR,logging)
4893+
librer_core = LibrerCore(DATA_DIR,record_exe,logging)
48794894

48804895
Gui(getcwd())
48814896

0 commit comments

Comments
 (0)