# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import hashlib
-import re
+import os.path
try:
import json
hashes = load_hashes(hash_file_path)
result = []
for file_path in file_paths:
- file_name = re.sub(".*/", "", file_path)
+ file_name = os.path.basename(file_path)
if calculate_file_hash(file_path) != hashes.get(file_name, ""):
result.append(file_path)
return result
def update_file_hashes(hash_file_path, file_paths):
hashes = {}
for file_path in file_paths:
- file_name = re.sub(".*/", "", file_path)
+ file_name = os.path.basename(file_path)
hashes[file_name] = calculate_file_hash(file_path)
save_hashes(hash_file_path, hashes)