Skip to content

Commit

Permalink
Change remaining os.stat() usages
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix committed Sep 28, 2024
1 parent f748fbb commit bcdac4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion gui/wxpython/core/watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import os
import time

from pathlib import Path

import wx
from wx.lib.newevent import NewEvent

Expand Down Expand Up @@ -59,7 +62,7 @@ def on_modified(self, event):
not event.is_directory
and os.path.basename(event.src_path) == self.rcfile_name
):
timestamp = os.stat(event.src_path).st_mtime
timestamp = Path(event.src_path).stat().st_mtime
if timestamp - self.modified_time < 0.5:
return
self.modified_time = timestamp
Expand Down
5 changes: 3 additions & 2 deletions gui/wxpython/gui_core/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import os
import sys

from pathlib import Path

try:
import pwd

Expand Down Expand Up @@ -2425,8 +2427,7 @@ def LoadData(self):

for mapset in self.parent.all_mapsets_ordered:
index = self.InsertItem(self.GetItemCount(), mapset)
mapsetPath = os.path.join(locationPath, mapset)
stat_info = os.stat(mapsetPath)
stat_info = Path(locationPath, mapset).stat()
if havePwd:
try:
self.SetItem(index, 1, "%s" % pwd.getpwuid(stat_info.st_uid)[0])
Expand Down

0 comments on commit bcdac4a

Please sign in to comment.