mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
adjusted filepath lookup
This commit is contained in:
parent
8b09b7afaf
commit
a1e32cca1b
1 changed files with 27 additions and 10 deletions
|
@ -536,24 +536,41 @@ def get_hmac_salt(dxcallsign: bytes, mycallsign: bytes):
|
||||||
def search_hmac_salt(dxcallsign: bytes, mycallsign: bytes, search_token, data_frame, token_iters):
|
def search_hmac_salt(dxcallsign: bytes, mycallsign: bytes, search_token, data_frame, token_iters):
|
||||||
|
|
||||||
filename = f"freedata_hmac_STATION_{mycallsign.decode('utf-8')}_REMOTE_{dxcallsign.decode('utf-8')}.txt"
|
filename = f"freedata_hmac_STATION_{mycallsign.decode('utf-8')}_REMOTE_{dxcallsign.decode('utf-8')}.txt"
|
||||||
if sys.platform == "linux":
|
if sys.platform in ["linux"]:
|
||||||
subfolder = Path('hmac')
|
|
||||||
filepath = subfolder / filename
|
|
||||||
|
|
||||||
elif sys.platform == "darwin":
|
|
||||||
if hasattr(sys, "_MEIPASS"):
|
if hasattr(sys, "_MEIPASS"):
|
||||||
filepath = getattr(sys, "_MEIPASS") + '/hmac/' + filename
|
filepath = getattr(sys, "_MEIPASS") + '/hmac/' + filename
|
||||||
else:
|
else:
|
||||||
filepath = './hmac/' + filename
|
subfolder = Path('hmac')
|
||||||
|
filepath = subfolder / filename
|
||||||
|
|
||||||
|
|
||||||
|
elif sys.platform in ["darwin"]:
|
||||||
|
if hasattr(sys, "_MEIPASS"):
|
||||||
|
filepath = getattr(sys, "_MEIPASS") + '/hmac/' + filename
|
||||||
|
else:
|
||||||
|
subfolder = Path('hmac')
|
||||||
|
filepath = subfolder / filename
|
||||||
|
|
||||||
elif sys.platform in ["win32", "win64"]:
|
elif sys.platform in ["win32", "win64"]:
|
||||||
filepath = filename
|
if hasattr(sys, "_MEIPASS"):
|
||||||
pass
|
filepath = getattr(sys, "_MEIPASS") + '/hmac/' + filename
|
||||||
|
else:
|
||||||
|
subfolder = Path('hmac')
|
||||||
|
filepath = subfolder / filename
|
||||||
else:
|
else:
|
||||||
filepath = filename
|
try:
|
||||||
|
subfolder = Path('hmac')
|
||||||
|
filepath = subfolder / filename
|
||||||
|
except Exception as e:
|
||||||
|
log.error(
|
||||||
|
"[TNC] [HMAC] File lookup error", file=filepath,
|
||||||
|
)
|
||||||
|
|
||||||
# check if file exists else return false
|
# check if file exists else return false
|
||||||
if not check_if_file_exists(filename):
|
if not check_if_file_exists(filepath):
|
||||||
log.warning(
|
log.warning(
|
||||||
"[TNC] [HMAC] Token file not found", file=filename,
|
"[TNC] [HMAC] Token file not found", file=filepath,
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue