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
034643b5
Commit
034643b5
authored
Aug 05, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dokan: correctly handle CreateFile with disposition=CREATE_NEW
parent
ccf6c09e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
5 deletions
+25
-5
fs/expose/dokan/__init__.py
+25
-5
No files found.
fs/expose/dokan/__init__.py
View file @
034643b5
...
@@ -143,16 +143,22 @@ def handle_fs_errors(func):
...
@@ -143,16 +143,22 @@ def handle_fs_errors(func):
func
=
convert_fs_errors
(
func
)
func
=
convert_fs_errors
(
func
)
@wraps
(
func
)
@wraps
(
func
)
def
wrapper
(
*
args
,
**
kwds
):
def
wrapper
(
*
args
,
**
kwds
):
#print "CALL", name, args[1:-1]; sys.stdout.flush()
try
:
try
:
res
=
func
(
*
args
,
**
kwds
)
res
=
func
(
*
args
,
**
kwds
)
except
OSError
,
e
:
except
OSError
,
e
:
#print "ERR", name, e
if
e
.
errno
:
if
e
.
errno
:
res
=
-
1
*
_errno2syserrcode
(
e
.
errno
)
res
=
-
1
*
_errno2syserrcode
(
e
.
errno
)
else
:
else
:
res
=
-
1
res
=
-
1
except
Exception
,
e
:
#print "ERR", name, e
raise
else
:
else
:
if
res
is
None
:
if
res
is
None
:
res
=
0
res
=
0
#print "RES", name, res; sys.stdout.flush()
return
res
return
res
return
wrapper
return
wrapper
...
@@ -238,6 +244,10 @@ class FSOperations(DokanOperations):
...
@@ -238,6 +244,10 @@ class FSOperations(DokanOperations):
if
not
self
.
fs
.
exists
(
path
):
if
not
self
.
fs
.
exists
(
path
):
raise
ResourceNotFoundError
(
path
)
raise
ResourceNotFoundError
(
path
)
mode
=
"w+b"
mode
=
"w+b"
elif
disposition
==
CREATE_NEW
:
if
self
.
fs
.
exists
(
path
):
return
-
183
mode
=
"w+b"
else
:
else
:
mode
=
"r+b"
mode
=
"r+b"
else
:
else
:
...
@@ -255,6 +265,10 @@ class FSOperations(DokanOperations):
...
@@ -255,6 +265,10 @@ class FSOperations(DokanOperations):
if
not
self
.
fs
.
exists
(
path
):
if
not
self
.
fs
.
exists
(
path
):
raise
ResourceNotFoundError
(
path
)
raise
ResourceNotFoundError
(
path
)
mode
=
"w+b"
mode
=
"w+b"
elif
disposition
==
CREATE_NEW
:
if
self
.
fs
.
exists
(
path
):
return
-
183
mode
=
"w+b"
else
:
else
:
mode
=
"r+b"
mode
=
"r+b"
# Try to open the requested file. It may actually be a directory.
# Try to open the requested file. It may actually be a directory.
...
@@ -707,10 +721,16 @@ class MountProcess(subprocess.Popen):
...
@@ -707,10 +721,16 @@ class MountProcess(subprocess.Popen):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
import
os
,
os
.
path
import
os
,
os
.
path
from
fs.tempfs
import
TempFS
import
tempfile
fs
=
TempFS
()
from
fs.osfs
import
OSFS
fs
.
setcontents
(
"test1.txt"
,
"test one"
)
path
=
tempfile
.
mkdtemp
()
flags
=
DOKAN_OPTION_DEBUG
|
DOKAN_OPTION_STDERR
|
DOKAN_OPTION_REMOVABLE
try
:
mount
(
fs
,
"Q"
,
foreground
=
True
,
numthreads
=
1
,
flags
=
flags
)
fs
=
OSFS
(
path
)
fs
.
setcontents
(
"test1.txt"
,
"test one"
)
flags
=
DOKAN_OPTION_DEBUG
|
DOKAN_OPTION_STDERR
|
DOKAN_OPTION_REMOVABLE
mount
(
fs
,
"Q"
,
foreground
=
True
,
numthreads
=
1
,
flags
=
flags
)
fs
.
close
()
finally
:
OSFS
(
path
)
.
removedir
(
"/"
,
force
=
True
)
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