This commit is contained in:
Shota Shimazu 2018-08-30 12:00:49 +09:00
parent 65137a26b7
commit eb54851525
3 changed files with 21 additions and 34 deletions

View File

@ -10,9 +10,8 @@
259EE6222133C6D1005ECA44 /* Info.swift in Sources */ = {isa = PBXBuildFile; fileRef = 259EE6212133C6D1005ECA44 /* Info.swift */; };
259EE6242133C915005ECA44 /* BasicOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 259EE6232133C915005ECA44 /* BasicOperation.swift */; };
25BACE361F9F9E25000D5127 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25BACE351F9F9E25000D5127 /* Errors.swift */; };
25BACE381F9F9E6C000D5127 /* BasicOperation+Fileable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25BACE371F9F9E6C000D5127 /* BasicOperation+Fileable.swift */; };
25BACE381F9F9E6C000D5127 /* Operation+Fileable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25BACE371F9F9E6C000D5127 /* Operation+Fileable.swift */; };
25BACE3A1F9F9EB3000D5127 /* Info+Fileable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25BACE391F9F9EB3000D5127 /* Info+Fileable.swift */; };
25BACE3C1F9F9EDE000D5127 /* Utils+Fileable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25BACE3B1F9F9EDE000D5127 /* Utils+Fileable.swift */; };
25BACE3E1F9F9F12000D5127 /* iOS+Fileable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25BACE3D1F9F9F12000D5127 /* iOS+Fileable.swift */; };
25BACE401F9F9F36000D5127 /* FHS+Fileable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25BACE3F1F9F9F36000D5127 /* FHS+Fileable.swift */; };
D93F1CA21EAEDB6E009A7474 /* Fileable.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D93F1C981EAEDB6E009A7474 /* Fileable.framework */; };
@ -33,9 +32,8 @@
259EE6212133C6D1005ECA44 /* Info.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Info.swift; sourceTree = "<group>"; };
259EE6232133C915005ECA44 /* BasicOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicOperation.swift; sourceTree = "<group>"; };
25BACE351F9F9E25000D5127 /* Errors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Errors.swift; sourceTree = "<group>"; };
25BACE371F9F9E6C000D5127 /* BasicOperation+Fileable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BasicOperation+Fileable.swift"; sourceTree = "<group>"; };
25BACE371F9F9E6C000D5127 /* Operation+Fileable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Operation+Fileable.swift"; sourceTree = "<group>"; };
25BACE391F9F9EB3000D5127 /* Info+Fileable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Info+Fileable.swift"; sourceTree = "<group>"; };
25BACE3B1F9F9EDE000D5127 /* Utils+Fileable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Utils+Fileable.swift"; sourceTree = "<group>"; };
25BACE3D1F9F9F12000D5127 /* iOS+Fileable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "iOS+Fileable.swift"; sourceTree = "<group>"; };
25BACE3F1F9F9F36000D5127 /* FHS+Fileable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FHS+Fileable.swift"; sourceTree = "<group>"; };
D93F1C981EAEDB6E009A7474 /* Fileable.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Fileable.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@ -69,9 +67,8 @@
children = (
D93F1CB21EAEDCC9009A7474 /* Fileable.swift */,
25BACE351F9F9E25000D5127 /* Errors.swift */,
25BACE371F9F9E6C000D5127 /* BasicOperation+Fileable.swift */,
25BACE371F9F9E6C000D5127 /* Operation+Fileable.swift */,
25BACE391F9F9EB3000D5127 /* Info+Fileable.swift */,
25BACE3B1F9F9EDE000D5127 /* Utils+Fileable.swift */,
25BACE3D1F9F9F12000D5127 /* iOS+Fileable.swift */,
25BACE3F1F9F9F36000D5127 /* FHS+Fileable.swift */,
);
@ -236,10 +233,9 @@
files = (
25BACE3E1F9F9F12000D5127 /* iOS+Fileable.swift in Sources */,
D93F1CB31EAEDCC9009A7474 /* Fileable.swift in Sources */,
25BACE3C1F9F9EDE000D5127 /* Utils+Fileable.swift in Sources */,
25BACE3A1F9F9EB3000D5127 /* Info+Fileable.swift in Sources */,
25BACE361F9F9E25000D5127 /* Errors.swift in Sources */,
25BACE381F9F9E6C000D5127 /* BasicOperation+Fileable.swift in Sources */,
25BACE381F9F9E6C000D5127 /* Operation+Fileable.swift in Sources */,
25BACE401F9F9F36000D5127 /* FHS+Fileable.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -24,11 +24,24 @@ extension Fileable {
try Fileable.fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)
}
public func rm(_ target: String) throws {
try Fileable.fm.removeItem(atPath: target)
public func rm() throws {
try Fileable.fm.removeItem(atPath: self.path)
}
public func mv(from fromPath: String, to toPath: String) throws {
try Fileable.fm.moveItem(atPath: fromPath, toPath: toPath)
public func mv(to toPath: String) throws {
try Fileable.fm.moveItem(atPath: self.path, toPath: toPath)
}
public func chmod(mode: Int) throws {
print("This function is not implemented now.")
}
public static func touch(_ path: String) throws {
let empty = ""
do {
try empty.write(toFile: path, atomically: true, encoding: String.Encoding.utf8)
} catch let error as NSError {
print("failed to write: \(error)")
}
}
}

View File

@ -1,22 +0,0 @@
//
// Utils+Fileable.swift
// Fileable
//
// Created by Shota Shimazu on 2017/10/25.
// Copyright © 2017-2018 Shota Shimazu. All rights reserved.
//
import Foundation
// Utils
extension Fileable {
public func touch(_ path: String) throws {
let empty = ""
do {
try empty.write(toFile: path, atomically: true, encoding: String.Encoding.utf8)
} catch let error as NSError {
print("failed to write: \(error)")
}
}
}