Windows support

This commit is contained in:
sarah committed 2026-10-09 14:30:59 +02:00
1 parent 6b2b35f5da
commit b295db3fb6
9 files changed
+136 -26

No files matched your search

+14 -4
View File
@@ -5,7 +5,7 @@ import asyncio
import ctypes
import fnmatch
import os
import pwd
import sys
import re
import shutil
import subprocess
@@ -108,8 +108,8 @@ def _EntryModified(Entry: Path) -> str:
def _EntryOwner(Entry: Path) -> str:
try:
return pwd.getpwuid(Entry.stat().st_uid).pw_name
except (OSError, KeyError):
return Entry.owner() # works on Windows too (Python 3.13+), unlike pwd
except (OSError, KeyError, NotImplementedError):
return ""
@@ -150,6 +150,13 @@ except OSError:
def _EntryCreated(Entry: Path) -> str:
# Windows (and macOS) record it in plain stat() as st_birthtime.
try:
BirthTime = getattr(Entry.stat(), "st_birthtime", None)
except OSError:
BirthTime = None
if BirthTime:
return datetime.fromtimestamp(BirthTime).strftime("%d/%m/%y %H:%M")
if _Libc is None:
return ""
Buf = _StatxStruct()
@@ -915,7 +922,10 @@ class Browser(ft.Row):
self._OpenInEditor(EntryPath)
return
try:
subprocess.Popen(["xdg-open", str(EntryPath)])
if sys.platform == "win32":
os.startfile(str(EntryPath)) # the default app
else:
subprocess.Popen(["xdg-open", str(EntryPath)])
except OSError as Error:
self._Notify(f"Couldn't open {EntryPath.name}: {Error}")