Skip to content

Commit cdeb343

Browse files
committed
Updated path code
1 parent 9ef3ef5 commit cdeb343

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

path_traversal.command

+5-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# current_path = [] or ["", "root"]
77

88
dict_path = {
9-
"root": ["", "root"],
9+
"root": ["" , "root"],
1010
"current_path": [] or ["", "root"],
1111
"dirs": [],
1212
"path": []
@@ -23,8 +23,8 @@ def mkdir():
2323
print("ERR: DIRECTORY ALREADY EXISTS")
2424
else:
2525
dict_path["dirs"].append(dir)
26-
print("SUCC: CREATED")
2726
dict_path["path"].append(dir)
27+
print("SUCC: CREATED")
2828

2929

3030
"""
@@ -34,9 +34,7 @@ def mkdir():
3434
def ls():
3535
if dict_path["path"] == dict_path["root"]:
3636
dict_path["path"] = dict_path["dirs"]
37-
# dict_path["path"] = dict_path["path"]
38-
print("DIRS: ")
39-
print(*dict_path["path"], sep="\t")
37+
print("DIRS: ", *dict_path["path"], sep="\t")
4038

4139

4240
"""
@@ -75,7 +73,6 @@ def rm():
7573
global dict_path
7674
if dir in dict_path["dirs"]:
7775
dict_path["dirs"].remove(dir)
78-
dict_path["path"].remove(dir)
7976
print("SUCC: DELETED")
8077
else:
8178
print("ERR: DIRECTORY DOES NOT EXIST")
@@ -89,7 +86,7 @@ def session_clear():
8986
global dict_path
9087
dict_path["dirs"].clear()
9188
dict_path["current_path"].clear()
92-
dict_path["current_path"] = dict_path["root"] or dict_path[""]
89+
dict_path["current_path"] = dict_path["root"]
9390
dict_path["path"].clear()
9491
print("SUCC: CLEARED: RESET TO ROOT")
9592

@@ -120,7 +117,7 @@ print("INFO - COMMANDS TO USE : mkdir, ls, cd, pwd, rm, session_clear, exit")
120117
print("<Starting your application...>")
121118

122119
while True:
123-
char = input("$:")
120+
char = input("$: ")
124121
command_list = []
125122
command_list.append(char.split(" "))
126123
char = command_list[0][0]

0 commit comments

Comments
 (0)