File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -313,18 +313,19 @@ def expanduser(path):
313
313
userhome = join (drive , os .environ ['HOMEPATH' ])
314
314
315
315
if i != 1 : #~user
316
- # Try to guess user home directory. By default all users directories
317
- # are located in the same place and are named by corresponding
318
- # usernames. If current user home directory points to nonstandard
319
- # place, this guess is likely wrong, and so we bail out.
320
- current_user = os .environ .get ('USERNAME' )
321
- if current_user != basename (userhome ):
322
- return path
323
-
324
316
target_user = path [1 :i ]
325
317
if isinstance (target_user , bytes ):
326
318
target_user = os .fsdecode (target_user )
319
+ current_user = os .environ .get ('USERNAME' )
320
+
327
321
if target_user != current_user :
322
+ # Try to guess user home directory. By default all user
323
+ # profile directories are located in the same place and are
324
+ # named by corresponding usernames. If userhome isn't a
325
+ # normal profile directory, this guess is likely wrong,
326
+ # so we bail out.
327
+ if current_user != basename (userhome ):
328
+ return path
328
329
userhome = join (dirname (userhome ), target_user )
329
330
330
331
if isinstance (path , bytes ):
You can’t perform that action at this time.
0 commit comments