File tree 1 file changed +17
-15
lines changed
1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change 1
1
import asyncio
2
2
import logging
3
+ import re
3
4
from functools import partial
4
5
5
6
from PyQt5 import QtCore , QtWidgets
@@ -77,23 +78,24 @@ def accept(self):
77
78
if selected :
78
79
selected = selected [0 ].text ()
79
80
if selected == ".." :
80
- if (not self .explorer .current_directory
81
- or self .explorer .current_directory [- 1 ] not in "\\ /" ):
81
+ if not self .explorer .current_directory :
82
82
return
83
- idx = None
84
- for sep in "\\ /" :
85
- try :
86
- idx = self .explorer .current_directory [:- 1 ].rindex (sep )
87
- except ValueError :
88
- pass
89
- else :
90
- break
91
- if idx is None :
92
- return
93
- self .explorer .current_directory = \
94
- self .explorer .current_directory [:idx + 1 ]
95
- if self .explorer .current_directory == "/" :
83
+ if re .fullmatch ("[a-zA-Z]:\\ \\ " ,
84
+ self .explorer .current_directory ):
96
85
self .explorer .current_directory = ""
86
+ else :
87
+ idx = None
88
+ for sep in "\\ /" :
89
+ try :
90
+ idx = self .explorer .current_directory [:- 1 ].rindex (sep )
91
+ except ValueError :
92
+ pass
93
+ else :
94
+ break
95
+ self .explorer .current_directory = \
96
+ self .explorer .current_directory [:idx + 1 ]
97
+ if self .explorer .current_directory == "/" :
98
+ self .explorer .current_directory = ""
97
99
asyncio .ensure_future (self .refresh_view ())
98
100
elif selected [- 1 ] in "\\ /" :
99
101
self .explorer .current_directory += selected
You can’t perform that action at this time.
0 commit comments