Skip to content

Commit

Permalink
fix: accommodate directories for executables, just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
kernel-dev committed Mar 7, 2022
1 parent 7e15d3c commit a80c527
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import platform
import os
import sys

name = "OCSysInfo"
version = "0.0.1-alpha"
os_ver = ""
arch = platform.machine()
_platform = platform.system().lower()

# Colours!
pink = "\033[95m"
Expand Down Expand Up @@ -40,7 +40,6 @@ def format_text(text, formatting):
final_string += end_formatting
return final_string


surprise = f"""{cyan}
__ __ ______ _ _____ _
\ \ / / | ____| | | |_ _| |
Expand All @@ -67,4 +66,12 @@ def format_text(text, formatting):
"""

dir_delim = "\\" if platform.system().lower() == "windows" else "/"
root_dir = dir_delim.join((os.path.dirname(os.path.realpath(__file__))).split(dir_delim)[:-1])

if getattr(sys, 'frozen', False):
root_dir = os.path.dirname(sys.executable)
os.chdir(root_dir)
else:
root_dir = os.path.dirname(os.path.abspath(__file__))

if "src" in root_dir.split(dir_delim):
root_dir = dir_delim.join(root_dir.split(dir_delim)[:-1])

0 comments on commit a80c527

Please sign in to comment.