Skip to content

Commit

Permalink
[fix] Add directory check before move and copy
Browse files Browse the repository at this point in the history
  • Loading branch information
blyscuit committed Sep 28, 2023
1 parent 3449d97 commit 38e3828
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Scripts/Swift/Extensions/FileManager+Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extension FileManager {
atPath: "\(currentDirectory)/\(directory)"
)
if let files = files {
try? createDirectory(atPath: "\(currentDirectory)/\(directory)", withIntermediateDirectories: true, attributes: nil)
for file in files {
guard file != ".DS_Store" else { continue }
do {
Expand Down Expand Up @@ -36,6 +37,7 @@ extension FileManager {

func copy(file: String, to destination: String) {
let currentDirectory = currentDirectoryPath
try? createDirectory(atPath: "\(currentDirectory)/\(directory)", withIntermediateDirectories: true, attributes: nil)
do {
try copyItem(
atPath: "\(currentDirectory)/\(file)",
Expand Down

0 comments on commit 38e3828

Please sign in to comment.