Skip to content

Commit

Permalink
Made other OSes fuck off
Browse files Browse the repository at this point in the history
  • Loading branch information
dotargz committed Jul 16, 2022
1 parent ad4972e commit 89e749f
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys
import pygame
import json
import platform
import requests
import pyperclip as pc
import re
Expand Down Expand Up @@ -70,10 +71,18 @@ def load_logo():
print("[WARNING] Running in Standalone Mode")
print("Please run this program from the executable for the best results")

if platform.system() != "Windows":
print("[WARNING] Running on a non-Windows OS")
print("Please run this program from the executable for the best results")
WINDOWS = False
else:
WINDOWS = True

class Terminal(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
global STANDALONE
global NOTWINDOWS
self.BLUE = (0, 0, 255)
self.RED = (255, 0, 0)
self.GREEN = (0, 255, 0)
Expand All @@ -92,11 +101,12 @@ def __init__(self):
self.history = []
self.history_count = 0
self.current_input = ""
self.warning = ""
if WINDOWS == False:
self.warning += '\n[ WARN ] Non-Windows OS detected.\n[ NON-WINDOWS ] The terminal will not be able to run properly on non-Windows operating systems.'
if STANDALONE == True:
warning = '\n[ WARN ] Standalone mode enabled.\n[ STANDALONE ] Downloading assets...\n\nWARNING: YOU ARE RUNNING SUPERTERM AS A STANDALONE PYTHON FILE,\nTHE TERMINAL WILL REQUIRE A INTERNET CONNECTION TO WORK AS EXPECTED.\nTO RELOAD THE TERMINAL AND ITS ASSETS, RUN THE COMMAND "RELOAD".'
else:
warning = ''
self.current_display = f"{self.NAME} [Version {self.VERSION}]\n(c) 2022 OneSpark LLC. All rights reserved.{warning}\n\n"
self.warning += '\n[ WARN ] Standalone mode enabled.\n[ STANDALONE ] Downloading assets...\n\nWARNING: YOU ARE RUNNING SUPERTERM AS A STANDALONE PYTHON FILE,\nTHE TERMINAL WILL REQUIRE A INTERNET CONNECTION TO WORK AS EXPECTED.\nTO RELOAD THE TERMINAL AND ITS ASSETS, RUN THE COMMAND "RELOAD".'
self.current_display = f"{self.NAME} [Version {self.VERSION}]\n(c) 2022 OneSpark LLC. All rights reserved.{self.warning}\n\n"

def load_font(self, isReloading=False):
global FONT
Expand Down Expand Up @@ -201,7 +211,7 @@ def run_command(self, command, sandbox=False, notFirst=False):
print("Commnd length: " + str(len(tokenized)))
# list of valid commands
vaild_commands = ["echo", "clear", "exit",
"help", "run", "version", "debug", "license", "reload", "tkz", "ping", "update", "st", "kill"]
"help", "run", "version", "debug", "license", "reload", "tkz", "ping", "update", "st"]
command_alias = ["cls"]
# format the commands in various ways
list_commands = ", ".join(vaild_commands)
Expand Down Expand Up @@ -235,7 +245,7 @@ def run_command(self, command, sandbox=False, notFirst=False):
exit()
elif command == "help":
return_text = f"Commands: {list_commands}\n"
elif command == "run":
elif command == "run" and WINDOWS == True:
if "".join(command_params).replace(" ", "") == "":
return_text = "Error: No file specified.\n"
else:
Expand Down Expand Up @@ -293,14 +303,17 @@ def run_command(self, command, sandbox=False, notFirst=False):
return_text += f"- No updates available.\n"
except Exception as e:
return_text = "Error: Could not check for updates.\n"
elif command == "st":
elif command == "st" and WINDOWS == True:
os.system(f"start {os.path.basename(__file__)}")
if "-s" not in command_flags:
return_text = f"Running SuperTerm...\n"
else:
return_text = ""

else:
return_text = "Error: Command handler not found.\n"
if WINDOWS == False:
return_text += "Notice: Some commands may not work on Linux or MacOS.\n"
else:
return_text = f"Error: Command '{normal_command}' not found.\n"
if sandbox == False:
Expand Down

0 comments on commit 89e749f

Please sign in to comment.