1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
if msg_recu[0] == "cd":
if msg_recu[1] != "..":
complete_tab = copy.deepcopy(msg_recu)
complete_tab.remove(complete_tab[0])
if "C:\\" in complete_tab[0] :
if len(complete_tab) >= 1 :
path = " ".join(complete_tab)
if os.path.isdir(path):
location = path
os.chdir(location)
elif len(msg_recu) > 2:
folder = copy.deepcopy(msg_recu)
folder.remove(folder[0])
folder = " ".join(folder)
path = location+ '\\' + folder
if os.path.isdir(path):
location+='\\' + folder
os.chdir(location)
else:
path = location+ '\\' + msg_recu[1]
if os.path.isdir(path):
location+='\\' + msg_recu[1]
os.chdir(location)
elif msg_recu[1] != "":
location = location.split("\\")
location.remove(location[len(location) - 1])
location = "\\".join(location)
os.chdir(location)
else:
pass
if msg_recu[0] == "start" :
p = subprocess.Popen('start '+ msg_recu[1], stdout=subprocess.PIPE, shell=True)
out, error = p.communicate()
print(os.path.exists(os.getcwd()+'\\'+msg_recu[1]))
print(os.getcwd())
else:
pass |
Partager