Compare commits

...

61 Commits
1.1 ... main

Author SHA1 Message Date
Shota Shimazu 1bf0af80bb revise 2021-07-30 09:06:43 +09:00
Shota Shimazu 984de192ea Add xcode project file 2021-07-30 08:50:13 +09:00
Shota Shimazu 5968a3aff2 Remove old migrator 2021-07-30 08:45:22 +09:00
Shota Shimazu e0cfd40496 Migrate to travis-ci.com 2021-07-30 08:42:57 +09:00
Shota Shimazu 6ac7090646
Update README.md 2020-02-15 01:32:00 +09:00
Shota Shimazu 2bf41a2cd5
update copyright 2020-02-15 01:27:14 +09:00
Shota Shimazu 65c5237602
upgrade swift version 2020-02-15 01:24:52 +09:00
Shota Shimazu 450ba6cef5
remove xcodeproj from commit list 2020-02-15 01:24:45 +09:00
Shota Shimazu 15ecf990d0
remove xcodeproj 2020-02-15 01:24:32 +09:00
Shota Shimazu 66df0c6376
remove unused ci file 2020-02-15 01:23:06 +09:00
Shota Shimazu 0f36dd90d0
Update LICENSE 2019-01-16 12:21:52 +09:00
shotastage 193e3e01a5
fix inaccessible method 2019-01-16 10:37:53 +09:00
Shota Shimazu e5cc25a31a
WIP: Fix bugs (#5)
* fix internal inaccessible level

Signed-off-by: shotastage <hornet.live.mf@gmail.com>

* update changelog

Signed-off-by: shotastage <hornet.live.mf@gmail.com>

* fix

Signed-off-by: shotastage <hornet.live.mf@gmail.com>

* fix nullable method

Signed-off-by: shotastage <hornet.live.mf@gmail.com>
2019-01-16 10:33:10 +09:00
shotastage d374bc9186
disable under development feature 2019-01-15 13:22:49 +09:00
shotastage ac627c01d7
update todo 2019-01-15 13:20:39 +09:00
shotastage 2638053ed1
add get bundle file method 2019-01-15 13:18:34 +09:00
shotastage a66b465574
update todo 2019-01-13 20:08:11 +09:00
shotastage 76c1b21e98
add downloader 2019-01-13 20:06:49 +09:00
shotastage eb14b3114c
A HAPPY NEW YEAR 🎉 2019-01-01 11:54:18 +09:00
Shota Shimazu ce89810fdd add new permission 2018-12-12 14:00:40 +09:00
Shota Shimazu 29a762c572 update TODO 2018-12-12 13:55:13 +09:00
Shota Shimazu b5fb608ce5 update TODO 2018-12-12 13:54:42 +09:00
Shota Shimazu 3e2df60c27 revise 2018-12-10 13:14:30 +09:00
Shota Shimazu 590a9dbd87 remove minizip 2018-12-10 02:31:40 +09:00
Shota Shimazu 4e815c3049
remove Linux support 2018-12-10 01:57:43 +09:00
Shota Shimazu b2b4d5e711 remove freebsd code 2018-12-10 01:56:41 +09:00
Shota Shimazu 1a2aaef303 revise 2018-12-10 01:54:11 +09:00
Shota Shimazu 318af31c27 add bridging header 2018-12-10 01:48:02 +09:00
Shota Shimazu a5548b4780 minizip 2018-12-10 01:25:01 +09:00
Shota Shimazu 8acf4c56ba revise 2018-12-10 01:14:39 +09:00
Shota Shimazu 9e50381130 add iOS dirs test 2018-12-10 01:09:26 +09:00
Shota Shimazu 775834939e revise 2018-12-10 01:00:09 +09:00
Shota Shimazu ed86be8b0f compatible for both string and url type 2018-12-10 00:56:09 +09:00
Shota Shimazu e23fa26475 rename mkdirSwift 2018-12-10 00:01:42 +09:00
Shota Shimazu 984b7ffdca separate platform specific method 2018-12-10 00:00:21 +09:00
Shota Shimazu 536b4f9968 rename source files 2018-12-09 23:53:52 +09:00
Shota Shimazu 3361886483 add utilities 2018-12-09 23:52:37 +09:00
Shota Shimazu d42f9549b2 revise 2018-12-09 23:47:31 +09:00
Shota Shimazu acece91dd9 add compression level enum 2018-12-09 23:37:20 +09:00
Shota Shimazu ea50b8afad remove windows related code 2018-12-09 23:31:37 +09:00
Shota Shimazu 0d06741ce8 introduce mini zip 2018-12-09 23:22:55 +09:00
Shota Shimazu a87accf55f Merge remote-tracking branch 'refs/remotes/origin/master' 2018-12-09 17:39:21 +09:00
Shota Shimazu eb97d7afe6 add zip archiver base 2018-12-09 17:39:08 +09:00
Shota Shimazu a0e298ec1d add new permission 2018-12-09 17:38:44 +09:00
Shota Shimazu 22a661a1b7
change budge layout 2018-12-09 17:36:56 +09:00
Shota Shimazu 7847fbe03c
Update README.md 2018-12-09 17:36:26 +09:00
Shota Shimazu 9bae09258f
Merge pull request #3 from fossabot/master
Add license scan report and status
2018-12-09 17:36:02 +09:00
Shota Shimazu b2702ed637
Update README.md 2018-12-09 00:47:35 +09:00
Shota Shimazu 42aa83bbad add TODO comment 2018-12-09 00:41:26 +09:00
Shota Shimazu 9fd21a6185 add path link stored property 2018-12-09 00:24:41 +09:00
Shota Shimazu c863a3db5e Merge remote-tracking branch 'refs/remotes/origin/master' 2018-12-09 00:12:37 +09:00
Shota Shimazu 3caaa48825 support home and extended path 2018-12-09 00:12:20 +09:00
fossabot d02cd01cae Add license scan report and status
Signed-off-by: fossabot <badges@fossa.io>
2018-12-08 01:57:59 -08:00
Shota Shimazu 5e7472358e
Update TODO.md 2018-12-04 11:56:32 +09:00
Shota Shimazu a3bcbd86e7 Merge remote-tracking branch 'refs/remotes/origin/master'
Conflicts:
	Fileable.xcodeproj/project.pbxproj
2018-12-04 11:52:21 +09:00
Shota Shimazu b0e7984f2b add permission enum 2018-12-04 11:51:45 +09:00
Shota Shimazu 23545eb6b2 rename IOSDir to IOSDirs 2018-11-14 15:29:44 +09:00
Shota Shimazu a6253d6446
Update TODO.md 2018-11-14 14:46:15 +09:00
Shota Shimazu 0c30d19662 Merge remote-tracking branch 'refs/remotes/origin/master' 2018-11-14 14:32:31 +09:00
Shota Shimazu ceab4f1cb1 set minimum deployment target as 10.0 2018-11-14 14:32:15 +09:00
Shota Shimazu d19d16f461
Upgrade podspec version 2018-11-14 14:19:59 +09:00
26 changed files with 1204 additions and 728 deletions

3
.gitignore vendored
View File

@ -50,7 +50,7 @@ playground.xcworkspace
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Checkouts
Carthage/Build
@ -68,3 +68,4 @@ fastlane/test_output
Fileable.framework.zip
MEMO.md
.DS_Store

View File

@ -1,10 +0,0 @@
image: kylef/swiftenv
before_script:
- swiftenv install https://swift.org/builds/swift-3.1-release/ubuntu1604/swift-3.1-RELEASE/swift-3.1-RELEASE-ubuntu16.04.tar.gz
test:
script:
- swift build
tags:
- vapor

View File

@ -1 +1 @@
4.2
5.1.3

View File

@ -1,5 +1,5 @@
osx_image: xcode10
osx_image: xcode12.5
language: objective-c
xcode_project: Fileable.xcodeproj
xcode_scheme: Fileable
xcode_destination: platform=iOS Simulator,OS=12.0,name=iPhone XS
xcode_scheme: Fileable-Package
xcode_destination: platform=iOS Simulator,OS=14.5,name=iPhone 11

View File

@ -1,3 +1,19 @@
## Version 1.2.1
- Fix internal inaccessible level
## Version 1.2
- Implement get bundle file path method
- Support both String and URL type as a path param
- Separate platform specific method as a service
- Support making multiple directory at once
- Add path absolute or relative detector
## Version 1.1
- Fix building scheme failure

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Fileable'
s.version = '1.0.9'
s.version = '1.1'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'Unix command like file management library for Swift.'
s.description = <<-DESC

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -52,17 +50,6 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Fileable::Fileable"
BuildableName = "Fileable.framework"
BlueprintName = "Fileable"
ReferencedContainer = "container:Fileable.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

View File

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Fileable::Fileable"
BuildableName = "Fileable.framework"
BlueprintName = "Fileable"
ReferencedContainer = "container:Fileable.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Fileable::FileableTests"
BuildableName = "FileableTests.xctest"
BlueprintName = "FileableTests"
ReferencedContainer = "container:Fileable.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Fileable::Fileable"
BuildableName = "Fileable.framework"
BlueprintName = "Fileable"
ReferencedContainer = "container:Fileable.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2017-2018 Shota Shimazu
Copyright (c) 2017-2019 Shota Shimazu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
// swift-tools-version:4.0
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription

View File

@ -1,11 +1,11 @@
![Fileable](./Documentation/filekit_readme.png)
[![Build Status](https://travis-ci.org/shotastage/Fileable.swift.svg?branch=master)](https://travis-ci.org/shotastage/Fileable.swift)
[![Build Status](https://travis-ci.com/shotastage/Fileable.swift.svg?branch=main)](https://travis-ci.com/shotastage/Fileable.swift)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/shotasatge/Fileable)
[![Version](https://img.shields.io/cocoapods/v/Fileable.svg?style=flat)](http://cocoapods.org/pods/Fileable)
![iOS 10+](https://img.shields.io/badge/iOS-10%2B-blue.svg?style=flat)
![Linux supported](https://img.shields.io/badge/Linux-supported-5D9CEC.svg?style=flat)
![Swift 4](https://img.shields.io/badge/Swift-4-orange.svg?style=flat)
![Swift 5](https://img.shields.io/badge/Swift-5-orange.svg?style=flat)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fshotastage%2FFileable.swift.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fshotastage%2FFileable.swift?ref=badge_shield)
Fileable is file utilities for Swift.
@ -48,6 +48,10 @@ github "shotastage/Fileable"
# License
Fileable is licensed under the `MIT`.
You can use this library free of charge. Please include copyright notie in your program.
See [LICENSE](./LICENSE) for detail.
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fshotastage%2FFileable.swift.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fshotastage%2FFileable.swift?ref=badge_large)

View File

@ -3,7 +3,7 @@
// Fileable
//
// Created by Shota Shimazu on 2017/10/25.
// Copyright © 2017-2018 Shota Shimazu. All rights reserved.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
@ -33,6 +33,11 @@ public enum FileableError: Error {
/// Previous
case AleardyExists
/// Zip
case InvalidZipFile
case ZipCompressFailure
case ZipExtractFailure
/// Default
case Unkown(String)
}

View File

@ -3,7 +3,7 @@
// Fileable
//
// Created by Shota Shimazu on Oct 25, 2017.
// Copyright © 2017-2018 Shota Shimazu. All rights reserved.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
@ -13,21 +13,45 @@ open class Path {
// Path
var path: String
// Separator
public var separator: String = "/"
// Foundational File Manager
static var fm = FileManager.default
// Services
#if os(iOS) || os(watchOS) || os(tvOS)
public static let ios = FileableIOS.shared
#endif
#if os(Linux)
public static let linux = FileableLinux.shared
#endif
// Initializers
public init() {
public required init() {
self.path = Path.pwd
}
public init(_ path: String) {
if path == "~" {
self.path = Path.home
public init<T>(_ path: T) {
let castedPath: String
/// Compatible for both String and URL type
if let pathURL: URL = path as? URL {
castedPath = pathURL.path
} else {
self.path = path
castedPath = path as! String
}
self.path = castedPath
if castedPath == "~" {
if let range = castedPath.range(of: "~") {
self.path.replaceSubrange(range, with: Path.home)
}
}
}
}

View File

@ -1,14 +1,24 @@
//
// Linux+Fileable.swift
// FHS.swift
// Fileable
//
// Created by Shota Shimazu on 2017/10/25.
// Copyright © 2017-2018 Shota Shimazu. All rights reserved.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
#if os(Linux)
open class FileableLinux {
public static let shared = FileableLinux()
private init() { }
}
public enum UnixFS {
case root

View File

@ -0,0 +1,23 @@
//
// Network.swift
// Fileable
//
// Created by Shota Shimazu on 2019/01/13.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
#if DEBUG
open class Downloader {
public static let shared = Downloader()
private init() { }
func save(to: String) {
}
}
#endif

View File

@ -3,13 +3,14 @@
// Fileable
//
// Created by Shota Shimazu on 2017/10/25.
// Copyright © 2017-2018 Shota Shimazu. All rights reserved.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
extension Path {
// TODO: Implement cd clousure like Python with statement
public static func cd(_ path: String) throws {
if !Path.fm.changeCurrentDirectoryPath(path) {
if !Path.fm.fileExists(atPath: path) {
@ -19,9 +20,13 @@ extension Path {
}
}
}
public static func mkdir(_ path: String) throws {
try Path.fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)
public static func mkdir(_ paths: String..., ignoreError: Bool = true) throws {
for path in paths {
try Path.fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)
}
}
public func rm() throws {

View File

@ -0,0 +1,17 @@
//
// Permissions.swift
// Fileable
//
// Created by Shota Shimazu on 2018/12/04.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
public enum FileablePermissions {
case Readable
case Writeable
case Executable
case ReadOnly
}

View File

@ -3,7 +3,7 @@
// Fileable
//
// Created by Shota Shimazu on 2017/10/25.
// Copyright © 2017-2018 Shota Shimazu. All rights reserved.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
@ -105,3 +105,18 @@ extension Path {
return String(fileName.split(separator: ".").last!)
}
}
// Path type
extension Path {
/// Return whether path is absolute
public var isAbsolute: Bool {
return self.path.hasPrefix("/")
}
/// Return whether path is relative
public var isRelative: Bool {
return !isAbsolute
}
}

View File

@ -0,0 +1,46 @@
//
// Utilities.swift
// Fileable
//
// Created by Shota Shimazu on 2018/12/09.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
extension Path {
//
// URL Converter
//
public static func toURL(string: String) -> URL {
return URL(fileURLWithPath: string)
}
public static func toString(fileURL: URL) throws -> String {
let stringURL: String
do {
try stringURL = String(contentsOf: fileURL)
}
catch {
throw FileableError.TypeConvertionError
}
return stringURL
}
/// Change default slash separator
func changeDefaultSeparator(for newSeparator: String) {
self.separator = newSeparator
}
/// Change defualt file manager instance
func changeFileManagerBackend(new fmInstance: FileManager) {
Path.fm = fmInstance
}
}

View File

@ -0,0 +1,98 @@
//
// ZipArchive.swift
// Fileable
//
// Created by Shota Shimazu on 2018/12/09.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
#if os(Linux)
import MiniZip
#endif
/*
public enum ZipCompressionLevel {
case NoCompression
case BestSpeed
case Default
case BestCompression
var minizipLevel: Int32 {
switch self {
case .NoCompression:
return Z_NO_COMPRESSION
case .BestSpeed:
return Z_BEST_SPEED
case .Default:
return Z_DEFAULT_COMPRESSION
case .BestCompression:
return Z_BEST_COMPRESSION
}
}
}
class FileableZipArchiver {
// TODO: Complete implementing unzip method
func unzipFile(file: String, password: String?) throws {
// Unzip set up
var ret: Int32 = 0
var crc_ret: Int32 = 0
let bufferSize: UInt32 = 4096
var buffer = Array<CUnsignedChar>(repeating: 0, count: Int(bufferSize))
/// Open Zip file
let unzipTarget = unzOpen64(file)
/// Procedure
if unzGoToFirstFile(unzipTarget) != UNZ_OK {
throw FileableError.ZipExtractFailure
}
/// Close Zip file
defer {
unzClose(unzipTarget)
}
}
// TODO: Complete implementing zip method
func zipFile(file: String, password: String?, level: ZipCompressionLevel) throws {
throw FileableError.ZipCompressFailure
}
}
extension Path {
// TODO: Implement unzip
func unzip(password: String? = nil) throws {
guard !Path(self.path).isDir else {
throw FileableError.InvalidZipFile
}
}
func compress(password: String? = nil) throws {
// TODO: Implement zipping
}
}
*/

View File

@ -1,83 +0,0 @@
//
// iOS+Fileable.swift
// Fileable
//
// Created by Shota Shimazu on 2017/10/25.
// Copyright © 2017-2018 Shota Shimazu. All rights reserved.
//
import Foundation
#if os(iOS) || os(watchOS) || os(tvOS)
extension Path {
///
/// Deprecated methods
///
@available(*, unavailable, renamed: "iOSFileSystem.document.path")
static func appDocument() -> String {
fatalError("appDocument is deprecated!")
}
@available(*, unavailable, renamed: "iOSFileSystem.cache.path")
static func appCache() -> String {
fatalError("appCache is deprecated!")
}
//
// URL Converter
//
public static func toURL(string: String) -> URL {
return URL(fileURLWithPath: string)
}
public static func toString(fileURL: URL) throws -> String {
let stringURL: String
do {
try stringURL = String(contentsOf: fileURL)
}
catch {
throw FileableError.TypeConvertionError
}
return stringURL
}
}
/// iOSDir enum is list of iOS application directories
public enum IOSDir {
/// .document returns iOS Documents directory
case document
case inbox
case library
case cache
case tmp
/// path propaty returns directory path as String type
var path: String! {
switch self {
case .document:
return Path.fm.urls(for: .documentDirectory, in: .userDomainMask)[0].path
case .inbox:
return Path.fm.urls(for: .documentDirectory, in: .userDomainMask)[0].path + "inbox/"
case .library:
return Path.fm.urls(for: .libraryDirectory, in: .userDomainMask)[0].path
case .cache:
return Path.fm.urls(for: .cachesDirectory, in: .userDomainMask)[0].path
case .tmp:
return Path.fm.temporaryDirectory.path
}
}
}
#endif

View File

@ -0,0 +1,59 @@
//
// iOSFileable.swift
// Fileable
//
// Created by Shota Shimazu on 2018/12/09.
// Copyright © 2017-2020 Shota Shimazu. All rights reserved.
//
import Foundation
#if os(iOS) || os(watchOS) || os(tvOS)
open class FileableIOS {
public static let shared = FileableIOS()
private init() { }
public func getBundle(file: String) -> String? {
let path = Bundle.main.path(forResource: file.components(separatedBy: ".")[0] , ofType: file.components(separatedBy: ".")[1])
return path
}
}
public enum IOSDirs {
/// .document returns iOS Documents directory
case document
case inbox
case library
case cache
case tmp
/// path propaty returns directory path as String type
@available(iOS 10.0, *)
var path: String! {
switch self {
case .document:
return Path.fm.urls(for: .documentDirectory, in: .userDomainMask)[0].path
case .inbox:
return Path.fm.urls(for: .documentDirectory, in: .userDomainMask)[0].path + "inbox/"
case .library:
return Path.fm.urls(for: .libraryDirectory, in: .userDomainMask)[0].path
case .cache:
return Path.fm.urls(for: .cachesDirectory, in: .userDomainMask)[0].path
case .tmp:
return Path.fm.temporaryDirectory.path
}
}
}
#endif

33
TODO.md
View File

@ -1,10 +1,37 @@
# Version 1.3
- [ ] Implement Zip manager
- [ ] Implement downloader
- [ ] Implement cache system
- [ ] Implement Document Directory Manager
- [ ] Implement change mode
## Version 1.2 **[Current]**
- [x] Implement get bundle file path method
- [x] Support both String and URL type as a path param
- [x] Separate platform specific method as a service
- [x] Support making multiple directory at once
- [x] Add path absolute or relative detector
## Version 1.0.9
- Implement Chmod
- [ ] Implement Chmod
- iOS Directory
- [x] iOS Directory
## Version 1.0.8
- Implement List Dir
- [x] Implement List Dir

View File

@ -0,0 +1,49 @@
//
// PathTypeCasting.swift
// Fileable
//
// Created by Shota Shimazu on 2018/12/10.
//
import XCTest
@testable import Fileable
class PathTypeCastingTest: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testStringPathType() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
let path: String = "~"
let fm = FileManager.default
XCTAssertTrue(Path(path).path == fm.currentDirectoryPath)
}
func testURLPathType() {
let fm = FileManager.default
let path: URL = URL(fileURLWithPath: fm.currentDirectoryPath, isDirectory: true)
XCTAssertTrue(Path(path).path == fm.currentDirectoryPath)
}
func testPerformanceExample() {
// This is an example of a performance test case.
self.measure { }
}
}

View File

@ -23,13 +23,32 @@ class IOSDirsTest: XCTestCase {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
//let documentDirectory: String = IOSDirs.document.path
//let libraryDirectory: String = IOSDirs.library.path
let documentDirectory: String = IOSDirs.document.path
let inboxDirectory: String = IOSDirs.inbox.path
let libraryDirectory: String = IOSDirs.library.path
let cacheDirectory: String = IOSDirs.cache.path
let tmpDirectory: String = IOSDirs.tmp.path
NSLog("LOG: ")
// NSLog(documentDirectory)
// NSLog(libraryDirectory)
// XCTAssertEqual(current, moved)
NSLog("LOG: \(documentDirectory)")
NSLog("LOG: \(inboxDirectory)")
NSLog("LOG: \(libraryDirectory)")
NSLog("LOG: \(cacheDirectory)")
NSLog("LOG: \(tmpDirectory)")
XCTAssertTrue(documentDirectory.contains("Documents"))
XCTAssertTrue(inboxDirectory.contains("Documentsinbox"))
XCTAssertTrue(libraryDirectory.contains("Library"))
XCTAssertTrue(cacheDirectory.contains("Library/Caches"))
XCTAssertTrue(tmpDirectory.contains("tmp"))
}
func testGetBundleFile() {
let path = Path.ios.getBundle(file: "unlocated.txt")
XCTAssertNil(path)
}