Compare commits

...

3 Commits
0.4.2 ... 0.4.3

Author SHA1 Message Date
Max Howell
3333c731d3 Fix Travis 2019-01-21 12:57:13 -05:00
Max Howell
e15173cfbc Merge pull request #9 from LucianoPAlmeida/is-path-conveniece-add
Adding convenience extensions on Path->Bool
2019-01-20 19:28:05 -05:00
Luciano Almeida
7be264a38e Adding convenience extensions on Path->Bool 2019-01-20 22:13:13 -02:00
2 changed files with 31 additions and 18 deletions

View File

@@ -52,9 +52,9 @@ jobs:
- stage: deploy - stage: deploy
name: Jazzy name: Jazzy
before_install: | before_install: |
cat << EOF > .jazzy.yaml cat <<\ \ EOF> .jazzy.yaml
module: Path module: Path
module_version: $TRAVIS_TAG module_version: TRAVIS_TAG
custom_categories: custom_categories:
- name: Path - name: Path
children: children:
@@ -65,12 +65,13 @@ jobs:
output: output output: output
github_url: https://github.com/mxcl/Path.swift github_url: https://github.com/mxcl/Path.swift
EOF EOF
install: | sed -i '' "s/TRAVIS_TAG/$TRAVIS_TAG/" .jazzy.yaml
gem install jazzy # ^^ this weirdness because Travis multiline YAML is broken and inserts two
swift package generate-xcodeproj # spaces in front of the output which means we need a prefixed delimiter which
script: | # also weirdly stops bash from doing variable substitution
jazzy install: gem install jazzy
rm -rf output/docsets before_script: swift package generate-xcodeproj
script: jazzy
deploy: deploy:
provider: pages provider: pages
skip-cleanup: true skip-cleanup: true
@@ -81,10 +82,10 @@ jobs:
- name: CocoaPods - name: CocoaPods
before_install: | before_install: |
cat << EOF > Path.swift.podspec cat <<\ \ EOF> Path.swift.podspec
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Path.swift' s.name = 'Path.swift'
s.version = '$TRAVIS_TAG' s.version = 'TRAVIS_TAG'
s.summary = 'Delightful, robust file-pathing functions' s.summary = 'Delightful, robust file-pathing functions'
s.homepage = 'https://github.com/mxcl/Path.swift' s.homepage = 'https://github.com/mxcl/Path.swift'
s.license = { :type => 'Unlicense', :file => 'LICENSE.md' } s.license = { :type => 'Unlicense', :file => 'LICENSE.md' }
@@ -96,8 +97,10 @@ jobs:
s.tvos.deployment_target = '10.0' s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0' s.watchos.deployment_target = '3.0'
s.source_files = 'Sources/*' s.source_files = 'Sources/*'
s.swift_version = "4.2" s.swift_version = '4.2'
end end
EOF EOF
sed -i '' "s/TRAVIS_TAG/$TRAVIS_TAG/" Path.swift.podspec
# ^^ see the Jazzy deployment for explanation
install: gem install cocoapods --pre install: gem install cocoapods --pre
script: pod trunk push --allow-warnings script: pod trunk push

View File

@@ -6,6 +6,16 @@ public extension Path {
return FileManager.default.isWritableFile(atPath: string) return FileManager.default.isWritableFile(atPath: string)
} }
/// Returns true if the path represents an actual file that is also readable by the current user.
var isReadable: Bool {
return FileManager.default.isReadableFile(atPath: string)
}
/// Returns true if the path represents an actual file that is also deletable by the current user.
var isDeletable: Bool {
return FileManager.default.isDeletableFile(atPath: string)
}
/// Returns true if the path represents an actual directory. /// Returns true if the path represents an actual directory.
var isDirectory: Bool { var isDirectory: Bool {
var isDir: ObjCBool = false var isDir: ObjCBool = false