Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
agkyra
Commits
674f9616
Commit
674f9616
authored
Jun 24, 2015
by
Giorgos Korfiatis
Browse files
Get info of actual path in windows
parent
ae48b086
Changes
1
Hide whitespace changes
Inline
Side-by-side
agkyra/syncer/localfs_client.py
View file @
674f9616
...
...
@@ -22,6 +22,7 @@ import time
import
filecmp
import
shutil
import
errno
import
ctypes
from
watchdog.observers
import
Observer
from
watchdog.events
import
FileSystemEventHandler
...
...
@@ -146,9 +147,29 @@ def local_path_changes(path, state, unhandled_equal=True):
return
live_info
def
get_actual_windows_path
(
path
):
SIZE
=
1024
buf
=
ctypes
.
create_unicode_buffer
(
SIZE
)
rv
=
ctypes
.
windll
.
kernel32
.
GetShortPathNameW
(
path
,
buf
,
SIZE
)
if
rv
==
0
or
rv
>
SIZE
:
raise
ValueError
(
'Error in computing short %s'
%
rv
)
short
=
buf
.
value
rv
=
ctypes
.
windll
.
kernel32
.
GetLongPathNameW
(
short
,
buf
,
SIZE
)
if
rv
==
0
or
rv
>
SIZE
:
raise
ValueError
(
'Error in computing long %s'
%
rv
)
return
buf
.
value
def
get_live_info
(
path
):
if
path
is
None
:
return
{}
if
utils
.
iswin
():
try
:
actual_path
=
get_actual_windows_path
(
path
)
if
path
!=
actual_path
:
return
{}
except
ValueError
:
return
{}
stats
,
status
=
get_local_status
(
path
)
if
status
==
LOCAL_MISSING
:
return
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment