aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2024-07-27 15:30:05 -0500
committerAnthony Wang2024-07-27 15:30:05 -0500
commitebef0bf87a22630ea2d5160aaf51051767e92fa6 (patch)
treecf6c938d81c6f16d3010e981916c82172e480729
parent2cadf76f9da405d8b4ada0121d2f9f7fdc842f6c (diff)
Simplify get_parent logic
-rw-r--r--server.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/server.py b/server.py
index 7d33a66..6dd226d 100644
--- a/server.py
+++ b/server.py
@@ -29,8 +29,10 @@ con.commit()
def get_parent(path):
if path in watchdirs:
- return os.stat("/").st_ino
- return os.stat(pathlib.Path(path).parent).st_ino
+ parent = "/"
+ else:
+ parent = pathlib.Path(path).parent
+ return os.stat(parent).st_ino
class EventHandler(FileSystemEventHandler):