Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added -i flag to all rm statements, Updated README #10

Merged
merged 1 commit into from
May 2, 2024

Conversation

hugo-hamet
Copy link
Contributor

PR created after issue #9

After getting my PC's home directory wiped out, I decided to modify some of the code for it to be safer.

What caused the issue was this part of the code:

TLauncherName=$(basename *.jar .jar)
TLauncherDir="$HOME/${TLauncherName}"

[...]

rm -rf $TLauncherDir

Firstly, you should never assume that the user wants the TLauncherDir elsewhere than in the repository. Creating a flag for the script to adapt to this would be a great addition.
Next, note this: if there is no .jar file in the repository's directory, the TLauncherName variable will be set to * (try running echo $(basename *.jar .jar) in the cloned repository). The problem comes here: TLauncherDir is then set to $HOME/*
The rm -rf $TLauncherDir statement then deletes recursively $HOME/*, that is every folder existing in the user's home directory.

The addition of a -i flag to each rm statements is what allows the user to see each file that is about to get deleted, and refuse its deletion if an error occurs. I made sure the README explains it too:
"⚠️ Careful! During the execution of setup.py, you will be prompted by rm -rf statements. Respond y if you want the file deleted, or n if not."

@IvanivAnton IvanivAnton merged commit 6ff482d into IvanivAnton:main May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants