Commit f64112a5 by willmcgugan

Fixes for fsmount

parent a32a775d
......@@ -40,21 +40,31 @@ Mounts a file system on a system path"""
windows = platform == "Windows"
if options.unmount:
if windows:
try:
mount_path = args[0][:1]
except IndexError:
self.error('Mount path required\n')
self.error('Driver letter\n')
return 1
if windows:
from fs.expose import dokan
mount_path = mount_path[:1].upper()
self.output('unmounting %s:\n' % mount_path, True)
dokan.unmount(mount_path)
self.output('unmounting %s:' % mount_path, True)
return
else:
try:
mount_path = args[0]
except IndexError:
self.error('Mount path required\n')
return 1
from fs.expose import fuse
self.output('unmounting %s\n' % mount_path, True)
fuse.unmount(mount_path)
self.output('unmounting %s' % mount_path, True)
return
try:
......@@ -82,8 +92,6 @@ Mounts a file system on a system path"""
path = '/'
if not options.nocache:
fs.cache_hint(True)
if windows and not os.path.exists(mount_path):
os.makedirs(mount_path)
if windows:
from fs.expose import dokan
......@@ -92,7 +100,7 @@ Mounts a file system on a system path"""
self.error('Driver letter should be one character')
return 1
self.output("Mounting %s on %s:" % (fs, mount_path), True)
self.output("Mounting %s on %s:\n" % (fs, mount_path), True)
flags = dokan.DOKAN_OPTION_REMOVABLE
if options.debug:
flags |= dokan.DOKAN_OPTION_DEBUG | dokan.DOKAN_OPTION_STDERR
......@@ -105,8 +113,12 @@ Mounts a file system on a system path"""
volname=str(fs))
else:
if not os.path.exists(mount_path):
os.makedirs(mount_path)
from fs.expose import fuse
self.output("Mounting %s on %s" % (fs, mount_path), True)
self.output("Mounting %s on %s\n" % (fs, mount_path), True)
if options.foreground:
fuse_process = fuse.mount(fs,
......
......@@ -56,14 +56,20 @@ class TempFS(OSFS):
def __unicode__(self):
return u'<TempFS: %s>' % self._temp_dir
def __getstate__(self):
# If we are picking a TempFS, we want to preserve its contents,
# so we *don't* do the clean
state = super(TempFS, self).__getstate__()
self._cleaned = True
return state
def __setstate__(self, state):
"""Pickle the TempFS. TempFS delted their contents when closed, so pickling
is not garanteed to preserve the directory contents"""
state = super(TempFS, self).__setstate__(state)
self._temp_dir = tempfile.mkdtemp(self.identifier or "TempFS", dir=self.temp_dir)
super(TempFS, self).__init__(self._temp_dir,
dir_mode=self.dir_mode,
thread_synchronize=self.thread_synchronize)
self._cleaned = False
#self._temp_dir = tempfile.mkdtemp(self.identifier or "TempFS", dir=self.temp_dir)
#super(TempFS, self).__init__(self._temp_dir,
# dir_mode=self.dir_mode,
# thread_synchronize=self.thread_synchronize)
def close(self):
"""Removes the temporary directory.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment