Skip to content

Commit 1a43556

Browse files
committed
Add GetFileSecurity path variable
Fix libdokan import
1 parent 39e6503 commit 1a43556

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

fs/expose/dokan/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# Copyright (c) 2016-2016, Adrien J. <liryna.stark@gmail.com>.
6262
# All rights reserved; available under the terms of the MIT License.
6363

64-
from __future__ import with_statement
64+
from __future__ import with_statement, absolute_import
6565

6666
import six
6767
import sys
@@ -86,9 +86,7 @@
8686
from fs.wrapfs import WrapFS
8787

8888
try:
89-
if six.PY2: import libdokan
90-
elif six.PY3: from . import libdokan
91-
else: raise
89+
from . import libdokan
9290
except (NotImplementedError, EnvironmentError, ImportError, NameError,):
9391
is_available = False
9492
sys.modules.pop("fs.expose.dokan.libdokan", None)
@@ -311,13 +309,14 @@ def wrapper(self, *args):
311309
class FSOperations(object):
312310
"""Object delegating all DOKAN_OPERATIONS pointers to an FS object."""
313311

314-
def __init__(self, fs, fsname="NTFS", volname="Dokan Volume"):
312+
def __init__(self, fs, fsname="NTFS", volname="Dokan Volume", securityfolder=os.path.expanduser('~')):
315313
if libdokan is None:
316314
msg = 'dokan library (http://dokan-dev.github.io/) is not available'
317315
raise OSError(msg)
318316
self.fs = fs
319317
self.fsname = fsname
320318
self.volname = volname
319+
self.securityfolder = securityfolder
321320
self._files_by_handle = {}
322321
self._files_lock = threading.Lock()
323322
self._next_handle = MIN_FH
@@ -816,7 +815,7 @@ def GetFileSecurity(self, path, securityinformation, securitydescriptor, securit
816815
path = self._dokanpath2pyfs(path)
817816
if self.fs.isdir(path):
818817
res = libdokan.GetFileSecurity(
819-
os.path.expanduser('~'),
818+
self.securityfolder,
820819
ctypes.cast(securityinformation, libdokan.PSECURITY_INFORMATION)[0],
821820
securitydescriptor,
822821
securitydescriptorlength,

0 commit comments

Comments
 (0)