Skip to content

Commit

Permalink
Fix error where moving a folder creates an invalid path
Browse files Browse the repository at this point in the history
  • Loading branch information
clayellis committed Dec 22, 2017
1 parent 2e39fda commit fbb147a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Sources/Files.swift
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,12 @@ public class FileSystem {
* - throws: `FileSystem.Item.OperationError.moveFailed` if the item couldn't be moved
*/
public func move(to newParent: Folder) throws {
let newPath = newParent.path + name

var newPath = newParent.path + name

if kind == .folder && !newPath.hasSuffix("/") {
newPath += "/"
}

do {
try fileManager.moveItem(atPath: path, toPath: newPath)
path = newPath
Expand Down

0 comments on commit fbb147a

Please sign in to comment.