Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions freezetag/freezefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
CACHE_DIR = Path(user_cache_dir('freezetag', 'x1ppy'))

ST_ITEMS = ['st_atime', 'st_ctime', 'st_gid', 'st_mode', 'st_mtime', 'st_nlink', 'st_size', 'st_uid']
if platform.system() != 'Windows':
if platform.system() == 'Darwin':
ST_ITEMS.append('st_birthtime')


Expand Down Expand Up @@ -119,17 +119,21 @@ def __init__(self, verbose=False):
gid = 0
uid = 0

self.dir_stat = {
dir_stat_items = {
'st_atime': now,
'st_ctime': now,
'st_mtime': now,
'st_birthtime': now,
'st_mode': S_IFDIR | 0o755,
'st_nlink': 2,
'st_gid': gid,
'st_uid': uid,
}

if platform.system() == 'Darwin':
dir_stat_items['st_birthtime'] = now

self.dir_stat = dir_stat_items

def mount(self, directory, mount_point):
CACHE_DIR.mkdir(parents=True, exist_ok=True)

Expand All @@ -144,7 +148,16 @@ def mount(self, directory, mount_point):
self.checksum_db.flush()

print(f'mounting {mount_point}')
FUSE(self, mount_point, nothreads=True, foreground=True, fsname='freezefs', volname=Path(mount_point).name)

fuse_args = {'nothreads': True, 'foreground': True, 'fsname': 'freezefs',
'volname': Path(mount_point).name}

# Only MacOS supports FUSE volume names, so remove it for other FS to prevent RuntimeError
if platform.system() != 'Darwin':
del fuse_args['volname']

self._log_verbose(f'mounting FUSE with these args: {fuse_args}')
FUSE(self, mount_point, **fuse_args)

# Helpers
# =======
Expand Down