Skip to content

Commit

Permalink
Fix Split Image Folder content detection on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Feb 4, 2025
1 parent 78dda5f commit a7c0a4d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/split_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,17 @@ def is_user_file(path: "StrPath"):
"""Returns False for hidden files, system files and folders."""
if os.path.isdir(path) or os.path.basename(path).startswith("."):
return False
if sys.platform == "linux":
return True
stat_result = os.stat(path)
if sys.platform == "win32":
return not (
(stat_result.st_file_attributes & FILE_ATTRIBUTE_SYSTEM)
| (stat_result.st_file_attributes & FILE_ATTRIBUTE_HIDDEN)
)
# UF_HIDDEN is present on regular Windows files
return not stat_result.st_mode & UF_HIDDEN
if sys.platform == "darwin":
return not (stat_result.st_mode & UF_HIDDEN)
return True


def __get_images_from_directory(directory: "StrPath"):
Expand Down

0 comments on commit a7c0a4d

Please sign in to comment.