Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
fixed paths, functionality for deactivate added
Browse files Browse the repository at this point in the history
  • Loading branch information
mickoissicko committed Feb 3, 2024
1 parent 94ae3ec commit 16b68fd
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions setup/setupmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,27 @@ def activate():

with open(dot_files, 'a') as file:
file.write(f'# HelloShell Startup Configuration\n')
file.write(f'python ..{current_working_directory}/scripts/welcomeshell.py\n')
file.write(f'python {current_working_directory}/scripts/welcomeshell.py\n')

def deactivate():
pass
config_file_path = "config/working.directory"
with open(config_file_path, 'r') as config_file:
config_contents = config_file.readlines()
df_path = None
for line in config_contents:
if line.startswith("DF="):
df_path = line.split('=')[1].strip()
break
try:
with open(df_path, 'r') as target_file:
file_contents = target_file.read()
modified_contents = file_contents.split("# HelloShell Startup Configuration")[0].split("python")[0].strip()
with open(df_path, 'w') as target_file:
target_file.write(modified_contents)
print(f"File '{df_path}' edited successfully.")
except FileNotFoundError:
print(f"File '{df_path}' not found.")


def main():
while True:
Expand Down

0 comments on commit 16b68fd

Please sign in to comment.