Skip to content

Commit

Permalink
Hide __MACOSX folders in file tree in speedgraders (#1342)
Browse files Browse the repository at this point in the history
* Consider the case of folder being mac_bs_file.

* Update comment.
  • Loading branch information
xinyis991105 authored May 2, 2021
1 parent c551799 commit 08822c0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,25 @@ def self.sanitize_directories(files)
# exist. If it does not, create and add them
if(!file[:directory])
paths = file[:pathname].split("/")
mac_bs_file = false
for path in paths do
# note that __MACOSX is actually a folder
# need to check whether the path includes that
# for the completeness of cleaned_files
# mac_bs_file folder paths will still be added
if path.include?("__MACOSX") || path.include?(".DS_Store") ||
path.include?(".metadata")
mac_bs_file = true
break
end
end
for i in 1..(paths.size - 1) do
new_path = paths[0,paths.size-i].join("/") + "/"
if(!file_path_set.include?(new_path))
cleaned_files.append({
:pathname=>new_path,
:header_position=>starting_header,
:mac_bs_file=>false,
:mac_bs_file=>mac_bs_file,
:directory=>true
})
starting_header = starting_header - 1
Expand Down

0 comments on commit 08822c0

Please sign in to comment.