From 84a96bd4d01d1fbe621a49a1c64a47d2dccff52b Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Fri, 11 Mar 2022 06:06:21 -0800 Subject: [PATCH] Cleaned up fileutil, rolled back changes for #654 --- osxphotos/fileutil.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/osxphotos/fileutil.py b/osxphotos/fileutil.py index d80315c7..db4f7a7c 100644 --- a/osxphotos/fileutil.py +++ b/osxphotos/fileutil.py @@ -3,11 +3,9 @@ import os import pathlib import stat -import subprocess import tempfile import typing as t from abc import ABC, abstractmethod -from datetime import datetime from tempfile import TemporaryDirectory import Foundation @@ -153,15 +151,6 @@ class FileUtilMacOS(FileUtilABC): def utime(cls, path, times): """Set the access and modified time of path.""" os.utime(path, times=times) - # verify the times were set correctly - # on some NAS devices, utime() may fail, see #654 - stat_ = os.stat(path) - if int(stat_.st_atime) != int(times[0]) or int(stat_.st_mtime) != int(times[1]): - # try to use touch to set the times - # touch format for -t is [[CC]YY]MMDDhhmm[.SS] - # use the first time in times provides, this assumes both atime and mtime are the same - touch_time = datetime.fromtimestamp(times[0]).strftime("%Y%m%d%H%M.%S") - subprocess.run(["/usr/bin/touch", "-t", touch_time, path]) @classmethod def cmp(cls, f1, f2, mtime1=None):