Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
9c5c4d49
Commit
9c5c4d49
authored
Aug 09, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dokan: better reporting of FILE_ATTRIBUTE_DIRECTORY
parent
0cc61670
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
fs/expose/dokan/__init__.py
+20
-10
No files found.
fs/expose/dokan/__init__.py
View file @
9c5c4d49
...
@@ -398,11 +398,11 @@ class FSOperations(DokanOperations):
...
@@ -398,11 +398,11 @@ class FSOperations(DokanOperations):
@handle_fs_errors
@handle_fs_errors
def
GetFileInformation
(
self
,
path
,
buffer
,
info
):
def
GetFileInformation
(
self
,
path
,
buffer
,
info
):
path
=
normpath
(
path
)
path
=
normpath
(
path
)
info
=
self
.
fs
.
getinfo
(
path
)
f
info
=
self
.
fs
.
getinfo
(
path
)
if
"name"
not
in
info
:
if
"name"
not
in
f
info
:
info
[
"name"
]
=
basename
(
path
)
f
info
[
"name"
]
=
basename
(
path
)
data
=
buffer
.
contents
data
=
buffer
.
contents
_info2finddataw
(
info
,
data
)
self
.
_info2finddataw
(
path
,
finfo
,
data
,
info
)
@handle_fs_errors
@handle_fs_errors
def
FindFiles
(
self
,
path
,
fillFindData
,
info
):
def
FindFiles
(
self
,
path
,
fillFindData
,
info
):
...
@@ -411,7 +411,7 @@ class FSOperations(DokanOperations):
...
@@ -411,7 +411,7 @@ class FSOperations(DokanOperations):
fpath
=
pathjoin
(
path
,
nm
)
fpath
=
pathjoin
(
path
,
nm
)
if
self
.
_is_pending_delete
(
fpath
):
if
self
.
_is_pending_delete
(
fpath
):
continue
continue
data
=
_info2finddataw
(
self
.
fs
.
getinfo
(
fpath
)
)
data
=
self
.
_info2finddataw
(
path
,
self
.
fs
.
getinfo
(
fpath
),
None
,
info
)
fillFindData
(
ctypes
.
byref
(
data
),
info
)
fillFindData
(
ctypes
.
byref
(
data
),
info
)
@handle_fs_errors
@handle_fs_errors
...
@@ -437,7 +437,7 @@ class FSOperations(DokanOperations):
...
@@ -437,7 +437,7 @@ class FSOperations(DokanOperations):
finfo
[
"name"
]
=
nm
finfo
[
"name"
]
=
nm
infolist
.
append
(
finfo
)
infolist
.
append
(
finfo
)
for
finfo
in
infolist
:
for
finfo
in
infolist
:
data
=
_info2finddataw
(
f
info
)
data
=
self
.
_info2finddataw
(
path
,
finfo
,
None
,
info
)
fillFindData
(
ctypes
.
byref
(
data
),
info
)
fillFindData
(
ctypes
.
byref
(
data
),
info
)
@handle_fs_errors
@handle_fs_errors
...
@@ -525,8 +525,8 @@ class FSOperations(DokanOperations):
...
@@ -525,8 +525,8 @@ class FSOperations(DokanOperations):
sz
=
(
len
(
nm
.
value
)
+
1
)
*
ctypes
.
sizeof
(
ctypes
.
c_wchar
)
sz
=
(
len
(
nm
.
value
)
+
1
)
*
ctypes
.
sizeof
(
ctypes
.
c_wchar
)
ctypes
.
memmove
(
fnmBuf
,
nm
,
sz
)
ctypes
.
memmove
(
fnmBuf
,
nm
,
sz
)
def
_info2attrmask
(
info
):
def
_info2attrmask
(
self
,
path
,
info
,
hinfo
=
None
):
"""Convert a file/directory info dict to a win32 file attributes
mask."""
"""Convert a file/directory info dict to a win32 file attribute
mask."""
attrs
=
0
attrs
=
0
st_mode
=
info
.
get
(
"st_mode"
,
None
)
st_mode
=
info
.
get
(
"st_mode"
,
None
)
if
st_mode
:
if
st_mode
:
...
@@ -534,13 +534,23 @@ def _info2attrmask(info):
...
@@ -534,13 +534,23 @@ def _info2attrmask(info):
attrs
|=
FILE_ATTRIBUTE_DIRECTORY
attrs
|=
FILE_ATTRIBUTE_DIRECTORY
elif
statinfo
.
S_ISREG
(
st_mode
):
elif
statinfo
.
S_ISREG
(
st_mode
):
attrs
|=
FILE_ATTRIBUTE_NORMAL
attrs
|=
FILE_ATTRIBUTE_NORMAL
elif
hinfo
:
if
hinfo
.
contents
.
IsDirectory
:
attrs
|=
FILE_ATTRIBUTE_DIRECTORY
else
:
attrs
|=
FILE_ATTRIBUTE_NORMAL
else
:
if
self
.
fs
.
isdir
(
path
):
attrs
|=
FILE_ATTRIBUTE_DIRECTORY
else
:
attrs
|=
FILE_ATTRIBUTE_NORMAL
return
attrs
return
attrs
def
_info2finddataw
(
info
,
data
=
None
):
def
_info2finddataw
(
self
,
path
,
info
,
data
=
None
,
hinfo
=
None
):
"""Convert a file/directory info dict into a WIN32_FIND_DATAW struct."""
"""Convert a file/directory info dict into a WIN32_FIND_DATAW struct."""
if
data
is
None
:
if
data
is
None
:
data
=
libdokan
.
WIN32_FIND_DATAW
()
data
=
libdokan
.
WIN32_FIND_DATAW
()
data
.
dwFileAttributes
=
_info2attrmask
(
info
)
data
.
dwFileAttributes
=
self
.
_info2attrmask
(
path
,
info
,
h
info
)
data
.
ftCreateTime
=
_datetime2filetime
(
info
.
get
(
"created_time"
,
None
))
data
.
ftCreateTime
=
_datetime2filetime
(
info
.
get
(
"created_time"
,
None
))
data
.
ftAccessTime
=
_datetime2filetime
(
info
.
get
(
"accessed_time"
,
None
))
data
.
ftAccessTime
=
_datetime2filetime
(
info
.
get
(
"accessed_time"
,
None
))
data
.
ftWriteTime
=
_datetime2filetime
(
info
.
get
(
"modified_time"
,
None
))
data
.
ftWriteTime
=
_datetime2filetime
(
info
.
get
(
"modified_time"
,
None
))
...
...
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