Compare commits
	
		
			2 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 61f9026e23 | ||
|   | 3e50149d4d | 
| @@ -1,6 +1,7 @@ | |||||||
| from __future__ import annotations | from __future__ import annotations | ||||||
|  |  | ||||||
| import secrets | import secrets | ||||||
|  | import sys | ||||||
| from functools import wraps | from functools import wraps | ||||||
| from hashlib import sha256 | from hashlib import sha256 | ||||||
| from pathlib import Path, PurePath | from pathlib import Path, PurePath | ||||||
| @@ -90,6 +91,8 @@ def config_update(modify): | |||||||
|             return "read" |             return "read" | ||||||
|         f.write(new) |         f.write(new) | ||||||
|         f.close() |         f.close() | ||||||
|  |         if sys.platform == "win32": | ||||||
|  |             conffile.unlink()  # Windows doesn't support atomic replace | ||||||
|         tmpname.rename(conffile)  # Atomic replace |         tmpname.rename(conffile)  # Atomic replace | ||||||
|     except: |     except: | ||||||
|         f.close() |         f.close() | ||||||
|   | |||||||
| @@ -129,7 +129,7 @@ def watcher_thread(loop): | |||||||
|     global rootpath |     global rootpath | ||||||
|     import inotify.adapters |     import inotify.adapters | ||||||
|  |  | ||||||
|     while True: |     while not quit: | ||||||
|         rootpath = config.config.path |         rootpath = config.config.path | ||||||
|         i = inotify.adapters.InotifyTree(rootpath.as_posix()) |         i = inotify.adapters.InotifyTree(rootpath.as_posix()) | ||||||
|         # Initialize the tree from filesystem |         # Initialize the tree from filesystem | ||||||
| @@ -218,11 +218,15 @@ def _walk(rel: PurePosixPath, isfile: int, st: stat_result) -> list[FileEntry]: | |||||||
|     try: |     try: | ||||||
|         li = [] |         li = [] | ||||||
|         for f in path.iterdir(): |         for f in path.iterdir(): | ||||||
|  |             if quit: | ||||||
|  |                 raise SystemExit("quit") | ||||||
|             if f.name.startswith("."): |             if f.name.startswith("."): | ||||||
|                 continue  # No dotfiles |                 continue  # No dotfiles | ||||||
|             s = f.stat() |             s = f.stat() | ||||||
|             li.append((int(not stat.S_ISDIR(s.st_mode)), f.name, s)) |             li.append((int(not stat.S_ISDIR(s.st_mode)), f.name, s)) | ||||||
|         for [isfile, name, s] in humansorted(li): |         for [isfile, name, s] in humansorted(li): | ||||||
|  |             if quit: | ||||||
|  |                 raise SystemExit("quit") | ||||||
|             subtree = _walk(rel / name, isfile, s) |             subtree = _walk(rel / name, isfile, s) | ||||||
|             child = subtree[0] |             child = subtree[0] | ||||||
|             entry.mtime = max(entry.mtime, child.mtime) |             entry.mtime = max(entry.mtime, child.mtime) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user