Skip to content

Commit

Permalink
fixup! Display proper file size for symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
BGazotti committed May 4, 2024
1 parent 24044f6 commit 69c97b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Mopy/bash/bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,11 +1094,14 @@ def _setmtime(self, new_time):
mtime = property(_getmtime, _setmtime, doc='Time file was last modified.')

def size_mtime(self):
lstat = os.lstat(self._s)
if os.path.islink(self._s) and os.path.exists(self._s):
lstat = os.stat(self._s, follow_symlinks=True)
else:
lstat = os.stat(self._s, follow_symlinks=False)
return lstat.st_size, lstat.st_mtime

def size_mtime_ctime(self):
lstat = os.lstat(self._s)
lstat = os.stat(self._s)
return lstat.st_size, lstat.st_mtime, lstat.st_ctime

@property
Expand Down

0 comments on commit 69c97b9

Please sign in to comment.