BenMatteson / CS410_Agile_Group2

CS410 Agile Practice Project - FTP Client
0 stars 2 forks source link

command history follows cd #70

Open BenMatteson opened 5 years ago

BenMatteson commented 5 years ago

because command history is saved in the local working directory and cdl changes the local working directory, new command_history.txt files are created in each new directory after cdl.

eddiekelleypdx commented 5 years ago

A simple fix for this might be to put that file into the home directory of the user: HISTORY_FILE = os.path.join(os.path.expanduser("~"), "command_history.txt")

BenMatteson commented 5 years ago

it also breaks help

eddiekelleypdx commented 5 years ago

I think that I noticed that as well, but didn't get a chance to figure it out.

eddiekelleypdx commented 5 years ago

I'm a little confused about how that breaks help? There doesn't seem to be any obvious connection to help (it doesn't use that constant)...

I suspect that the correlation may be that both help and the history commands are throwing a FileNotFoundError exception, which we're catching within print_help()?

BenMatteson commented 5 years ago

help uses a relative path, and cdl changes the actual working directory, so the relative path breaks.

eddiekelleypdx commented 5 years ago

Ah... It seems like that's also the case if the program/script is called from outside of the project folder (e.g., ./path/to/FTP_main.py). We might be able to get around that by using something like this:

HELP_FILE_LOCATION = os.path.join(os.path.dirname(os.path.realpath(__file__)), "help_files/")