├── .gitignore ├── LICENSE.md ├── Logo.png ├── README.md ├── Sample ├── Podfile ├── Podfile.lock ├── Pods │ ├── Local Podspecs │ │ └── UNIXFileSystem.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ └── xcuserdata │ │ │ ├── Meniny.xcuserdatad │ │ │ └── xcschemes │ │ │ │ ├── Pods-UNIXFileSystem.Sample.xcscheme │ │ │ │ ├── UNIXFileSystem.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ │ └── elias.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── Pods-UNIXFileSystem.Sample.xcscheme │ │ │ ├── UNIXFileSystem.xcscheme │ │ │ └── xcschememanagement.plist │ └── Target Support Files │ │ ├── Pods-UNIXFileSystem.Sample │ │ ├── Info.plist │ │ ├── Pods-UNIXFileSystem.Sample-Info.plist │ │ ├── Pods-UNIXFileSystem.Sample-acknowledgements.markdown │ │ ├── Pods-UNIXFileSystem.Sample-acknowledgements.plist │ │ ├── Pods-UNIXFileSystem.Sample-dummy.m │ │ ├── Pods-UNIXFileSystem.Sample-frameworks.sh │ │ ├── Pods-UNIXFileSystem.Sample-resources.sh │ │ ├── Pods-UNIXFileSystem.Sample-umbrella.h │ │ ├── Pods-UNIXFileSystem.Sample.debug.xcconfig │ │ ├── Pods-UNIXFileSystem.Sample.modulemap │ │ └── Pods-UNIXFileSystem.Sample.release.xcconfig │ │ └── UNIXFileSystem │ │ ├── Info.plist │ │ ├── UNIXFileSystem-Info.plist │ │ ├── UNIXFileSystem-dummy.m │ │ ├── UNIXFileSystem-prefix.pch │ │ ├── UNIXFileSystem-umbrella.h │ │ ├── UNIXFileSystem.modulemap │ │ └── UNIXFileSystem.xcconfig ├── UNIXFileSystem UNIXFileSystemSample │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── UNIXFileSystem.Sample.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Sample.xcscheme │ └── xcuserdata │ │ ├── Meniny.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── elias.xcuserdatad │ │ └── xcschemes │ │ ├── UNIXFileSystemSample.xcscheme │ │ └── xcschememanagement.plist └── UNIXFileSystem.Sample.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ ├── Meniny.xcuserdatad │ └── UserInterfaceState.xcuserstate │ └── elias.xcuserdatad │ └── UserInterfaceState.xcuserstate ├── UNIXFileSystem.podspec └── UNIXFileSystem ├── Source ├── AliasFile.swift ├── Aliasable.swift ├── Copyable.swift ├── CopyableSubitem.swift ├── Directory.swift ├── File.swift ├── FileHandleConvertible.swift ├── FileWrapperConvertible.swift ├── Item.swift ├── Linkable.swift ├── MIMEType.swift ├── Moveable.swift ├── MoveableSubitem.swift ├── Parent.swift ├── Path.swift ├── PathRepresentable.swift ├── RegularFile.swift ├── Removeable.swift ├── Renameable.swift ├── Subitem.swift ├── SymbolicLink.swift ├── SymbolicLinkable.swift ├── Trashable.swift ├── UFS.swift ├── UNIXFileSystem.h └── Volume.swift ├── UNIXFileSystem.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── elias.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── Meniny.xcuserdatad │ └── xcschemes │ │ ├── iOS.xcscheme │ │ ├── macOS.xcscheme │ │ ├── tvOS.xcscheme │ │ ├── watchOS.xcscheme │ │ └── xcschememanagement.plist │ └── elias.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── iOS ├── Info.plist └── iOS.h ├── macOS ├── Info.plist └── macOS.h ├── tvOS ├── Info.plist └── tvOS.h └── watchOS ├── Info.plist └── watchOS.h /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /CocoaPod Example/PitayaExample.xcworkspace 3 | /CocoaPod Example/Podfile.lock 4 | /CocoaPod Example/Pods 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Meniny 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meniny/UNIXFileSystem/dcfa49365671160596e43b43acad28f04db0deef/Logo.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | UNIXFileSystem 4 |
5 | Version 6 | Author 7 | Build Passing 8 | Swift 9 |
10 | Platforms 11 | MIT 12 |
13 | Cocoapods 14 | Carthage 15 | SPM 16 |
17 |

18 | 19 | *** 20 | 21 | # What's this? 22 | 23 | `UNIXFileSystem` (aka `UFS`) is an UNIX file system manager for iOS/macOS/tvOS/watchOS platforms. 24 | 25 | ## Requirements 26 | 27 | * iOS 8.0+ 28 | * macOS 10.10+ 29 | * watchOS 2.0+ 30 | * tvOS 9.0+ 31 | * Xcode 9 with Swift 5 32 | 33 | ## Installation 34 | 35 | #### CocoaPods 36 | 37 | ```ruby 38 | platform :ios, '8.0' 39 | 40 | target 'YOUAR_TARGET_NAME' do 41 | use_frameworks! 42 | 43 | pod 'UNIXFileSystem' 44 | end 45 | ``` 46 | 47 | ## Types 48 | 49 | The main Types in `UNIXFileSystem` are listed below with _protocols being emphasized_: 50 | 51 | - UFSPath 52 | - UFSRegularFile 53 | - UFSSymbolicLink 54 | - UFSAliasFile 55 | - UFSDirectory 56 | - UFSVolume 57 | - _UFSPathRepresentable_ 58 | - _UFSParent_ 59 | - _UFSSubitem_ 60 | - _UFSCopyable_ 61 | - _UFSCopyableSubitem_ 62 | - _UFSMoveable_ 63 | - _UFSMoveableSubitem_ 64 | - _UFSRenameable_ 65 | - _UFSRemovable_ 66 | - _UFSTrashable_ 67 | - _UFSLinkable_ 68 | - _UFSSymbolicLinkable_ 69 | - _UFSAliasable_ 70 | - _UFSFileHandleConvertible_ 71 | - _UFSFileWrapperConvertible_ 72 | - _UFSItem_ 73 | - _UFSFile_ 74 | 75 | ## Contribution 76 | 77 | You are welcome to fork and submit pull requests. 78 | 79 | ## License 80 | 81 | UFS is open-sourced software, licensed under the `MIT` license. 82 | -------------------------------------------------------------------------------- /Sample/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '8.0' 2 | 3 | target 'UNIXFileSystem.Sample' do 4 | use_frameworks! 5 | pod 'UNIXFileSystem', :path => '../' 6 | end 7 | -------------------------------------------------------------------------------- /Sample/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - UNIXFileSystem (2.3.0) 3 | 4 | DEPENDENCIES: 5 | - UNIXFileSystem (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | UNIXFileSystem: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | UNIXFileSystem: 808afdbb31473600910e2bedc9af751dcbe5f1db 13 | 14 | PODFILE CHECKSUM: 9c006d6dd046a9ae6067d9f73e5e8d3869d8fd45 15 | 16 | COCOAPODS: 1.7.0.beta.3 17 | -------------------------------------------------------------------------------- /Sample/Pods/Local Podspecs/UNIXFileSystem.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UNIXFileSystem", 3 | "summary": "UNIXFileSystem is an UNIX file system framework for iOS/macOS/tvOS/watchOS platforms.", 4 | "version": "2.3.0", 5 | "homepage": "https://github.com/Meniny/UNIXFileSystem", 6 | "license": "MIT", 7 | "authors": { 8 | "Meniny": "Meniny@qq.com" 9 | }, 10 | "source": { 11 | "git": "https://github.com/Meniny/UNIXFileSystem.git", 12 | "tag": "2.3.0" 13 | }, 14 | "social_media_url": "https://meniny.cn/", 15 | "swift_versions": "5", 16 | "platforms": { 17 | "ios": "8.0", 18 | "osx": "10.10", 19 | "tvos": "9.0", 20 | "watchos": "2.0" 21 | }, 22 | "source_files": "UNIXFileSystem/Source/*.swift", 23 | "requires_arc": true, 24 | "frameworks": "Foundation" 25 | } 26 | -------------------------------------------------------------------------------- /Sample/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - UNIXFileSystem (2.3.0) 3 | 4 | DEPENDENCIES: 5 | - UNIXFileSystem (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | UNIXFileSystem: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | UNIXFileSystem: 808afdbb31473600910e2bedc9af751dcbe5f1db 13 | 14 | PODFILE CHECKSUM: 9c006d6dd046a9ae6067d9f73e5e8d3869d8fd45 15 | 16 | COCOAPODS: 1.7.0.beta.3 17 | -------------------------------------------------------------------------------- /Sample/Pods/Pods.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/Pods-UNIXFileSystem.Sample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Sample/Pods/Pods.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/UNIXFileSystem.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Sample/Pods/Pods.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-UNIXFileSystem.Sample.xcscheme 8 | 9 | isShown 10 | 11 | 12 | UNIXFileSystem.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Sample/Pods/Pods.xcodeproj/xcuserdata/elias.xcuserdatad/xcschemes/Pods-UNIXFileSystem.Sample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Sample/Pods/Pods.xcodeproj/xcuserdata/elias.xcuserdatad/xcschemes/UNIXFileSystem.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Sample/Pods/Pods.xcodeproj/xcuserdata/elias.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-UNIXFileSystem.Sample.xcscheme 8 | 9 | isShown 10 | 11 | 12 | UNIXFileSystem.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## UNIXFileSystem 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2015 Meniny 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | Generated by CocoaPods - https://cocoapods.org 29 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | The MIT License (MIT) 18 | 19 | Copyright (c) 2015 Meniny <Meniny@qq.com> 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | UNIXFileSystem 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | Generated by CocoaPods - https://cocoapods.org 49 | Title 50 | 51 | Type 52 | PSGroupSpecifier 53 | 54 | 55 | StringsTable 56 | Acknowledgements 57 | Title 58 | Acknowledgements 59 | 60 | 61 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_UNIXFileSystem_Sample : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_UNIXFileSystem_Sample 5 | @end 6 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 90 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 104 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 105 | else 106 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Copies the bcsymbolmap files of a vendored framework 113 | install_bcsymbolmap() { 114 | local bcsymbolmap_path="$1" 115 | local destination="${BUILT_PRODUCTS_DIR}" 116 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 117 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 118 | } 119 | 120 | # Signs a framework with the provided identity 121 | code_sign_if_enabled() { 122 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 123 | # Use the current code_sign_identity 124 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 125 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 126 | 127 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 128 | code_sign_cmd="$code_sign_cmd &" 129 | fi 130 | echo "$code_sign_cmd" 131 | eval "$code_sign_cmd" 132 | fi 133 | } 134 | 135 | # Strip invalid architectures 136 | strip_invalid_archs() { 137 | binary="$1" 138 | # Get architectures for current target binary 139 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 140 | # Intersect them with the architectures we are building for 141 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 142 | # If there are no archs supported by this binary then warn the user 143 | if [[ -z "$intersected_archs" ]]; then 144 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 145 | STRIP_BINARY_RETVAL=0 146 | return 147 | fi 148 | stripped="" 149 | for arch in $binary_archs; do 150 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 151 | # Strip non-valid architectures in-place 152 | lipo -remove "$arch" -output "$binary" "$binary" 153 | stripped="$stripped $arch" 154 | fi 155 | done 156 | if [[ "$stripped" ]]; then 157 | echo "Stripped $binary of architectures:$stripped" 158 | fi 159 | STRIP_BINARY_RETVAL=1 160 | } 161 | 162 | 163 | if [[ "$CONFIGURATION" == "Debug" ]]; then 164 | install_framework "${BUILT_PRODUCTS_DIR}/UNIXFileSystem/UNIXFileSystem.framework" 165 | fi 166 | if [[ "$CONFIGURATION" == "Release" ]]; then 167 | install_framework "${BUILT_PRODUCTS_DIR}/UNIXFileSystem/UNIXFileSystem.framework" 168 | fi 169 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 170 | wait 171 | fi 172 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 12 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 13 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 14 | 15 | case "${TARGETED_DEVICE_FAMILY}" in 16 | 1,2) 17 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 18 | ;; 19 | 1) 20 | TARGET_DEVICE_ARGS="--target-device iphone" 21 | ;; 22 | 2) 23 | TARGET_DEVICE_ARGS="--target-device ipad" 24 | ;; 25 | 3) 26 | TARGET_DEVICE_ARGS="--target-device tv" 27 | ;; 28 | 4) 29 | TARGET_DEVICE_ARGS="--target-device watch" 30 | ;; 31 | *) 32 | TARGET_DEVICE_ARGS="--target-device mac" 33 | ;; 34 | esac 35 | 36 | install_resource() 37 | { 38 | if [[ "$1" = /* ]] ; then 39 | RESOURCE_PATH="$1" 40 | else 41 | RESOURCE_PATH="${PODS_ROOT}/$1" 42 | fi 43 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 44 | cat << EOM 45 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 46 | EOM 47 | exit 1 48 | fi 49 | case $RESOURCE_PATH in 50 | *.storyboard) 51 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 52 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 53 | ;; 54 | *.xib) 55 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 56 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 57 | ;; 58 | *.framework) 59 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 60 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 61 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 62 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 63 | ;; 64 | *.xcdatamodel) 65 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 66 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 67 | ;; 68 | *.xcdatamodeld) 69 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 70 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 71 | ;; 72 | *.xcmappingmodel) 73 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 74 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 75 | ;; 76 | *.xcassets) 77 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 78 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 79 | ;; 80 | *) 81 | echo "$RESOURCE_PATH" || true 82 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 83 | ;; 84 | esac 85 | } 86 | 87 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 88 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 89 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 90 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 91 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 92 | fi 93 | rm -f "$RESOURCES_TO_COPY" 94 | 95 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 96 | then 97 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 98 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 99 | while read line; do 100 | if [[ $line != "${PODS_ROOT}*" ]]; then 101 | XCASSET_FILES+=("$line") 102 | fi 103 | done <<<"$OTHER_XCASSETS" 104 | 105 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 106 | fi 107 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_UNIXFileSystem_SampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_UNIXFileSystem_SampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/UNIXFileSystem" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/UNIXFileSystem/UNIXFileSystem.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "UNIXFileSystem" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_UNIXFileSystem_Sample { 2 | umbrella header "Pods-UNIXFileSystem.Sample-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/UNIXFileSystem" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/UNIXFileSystem/UNIXFileSystem.framework/Headers" 5 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 6 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "UNIXFileSystem" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/UNIXFileSystem/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.2.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/UNIXFileSystem/UNIXFileSystem-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.3.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/UNIXFileSystem/UNIXFileSystem-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_UNIXFileSystem : NSObject 3 | @end 4 | @implementation PodsDummy_UNIXFileSystem 5 | @end 6 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/UNIXFileSystem/UNIXFileSystem-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/UNIXFileSystem/UNIXFileSystem-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double UNIXFileSystemVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char UNIXFileSystemVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/UNIXFileSystem/UNIXFileSystem.modulemap: -------------------------------------------------------------------------------- 1 | framework module UNIXFileSystem { 2 | umbrella header "UNIXFileSystem-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Sample/Pods/Target Support Files/UNIXFileSystem/UNIXFileSystem.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/UNIXFileSystem 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" 4 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem UNIXFileSystemSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // UNIXFileSystem UNIXFileSystemSample 4 | // 5 | // Created by Meniny on 2017-06-24. 6 | // Copyright © 2017年 Meniny. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem UNIXFileSystemSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Sample/UNIXFileSystem UNIXFileSystemSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem UNIXFileSystemSample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem UNIXFileSystemSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | FileSystem 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem UNIXFileSystemSample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // UNIXFileSystem UNIXFileSystemSample 4 | // 5 | // Created by Meniny on 2017-06-24. 6 | // Copyright © 2017年 Meniny. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import UNIXFileSystem 11 | 12 | class ViewController: UIViewController { 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | // Do any additional setup after loading the view, typically from a nib. 17 | 18 | let dir = FileSystem.document 19 | let folderName = "UFS_TEST_DIRECTORY \(Date())".replacingOccurrences(of: " ", with: "_") 20 | 21 | self.createDirectory(folderName, at: dir) 22 | print("-----------") 23 | self.listContents(of: dir) 24 | } 25 | 26 | func createDirectory(_ folderName: String, at dir: UFSDirectory) { 27 | let path = dir.path.appendingComponent(folderName) 28 | if !path.exists { 29 | if let _ = try? path.create(withIntermediateDirectories: true, attributes: nil) { 30 | print(folderName + " created") 31 | } else { 32 | print(folderName + " failed") 33 | } 34 | } else { 35 | print(folderName + " exists") 36 | } 37 | } 38 | 39 | func listContents(of dir: UFSDirectory) { 40 | if let items = try? dir.subitems() { 41 | for i in items { 42 | print(i.path.lastComponent) 43 | if i.isDirectory() { 44 | self.listContents(of: UFSDirectory(i.path)) 45 | } 46 | } 47 | } 48 | } 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5CCED9431EFEAD9B007A648C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CCED9421EFEAD9B007A648C /* AppDelegate.swift */; }; 11 | 5CCED9451EFEAD9B007A648C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CCED9441EFEAD9B007A648C /* ViewController.swift */; }; 12 | 5CCED9481EFEAD9B007A648C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5CCED9461EFEAD9B007A648C /* Main.storyboard */; }; 13 | 5CCED94A1EFEAD9B007A648C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5CCED9491EFEAD9B007A648C /* Assets.xcassets */; }; 14 | 5CCED94D1EFEAD9B007A648C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5CCED94B1EFEAD9B007A648C /* LaunchScreen.storyboard */; }; 15 | 5CCED9551EFEAE0A007A648C /* UNIXFileSystem.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CCED9541EFEAE0A007A648C /* UNIXFileSystem.framework */; }; 16 | F9EA4F6E5483A216D91099C9 /* Pods_UNIXFileSystem_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C6D2EFC9659426CD5CC2B73 /* Pods_UNIXFileSystem_Sample.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 0C6D2EFC9659426CD5CC2B73 /* Pods_UNIXFileSystem_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UNIXFileSystem_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 3F480A6103B3601D56483DED /* Pods_UNIXFileSystem_UNIXFileSystemSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_UNIXFileSystem_UNIXFileSystemSample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 51EE8F4BABB8211FA1560CED /* Pods-UNIXFileSystem UNIXFileSystemSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UNIXFileSystem UNIXFileSystemSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UNIXFileSystem UNIXFileSystemSample/Pods-UNIXFileSystem UNIXFileSystemSample.debug.xcconfig"; sourceTree = ""; }; 23 | 5CCED93F1EFEAD9B007A648C /* UNIXFileSystem.Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UNIXFileSystem.Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 5CCED9421EFEAD9B007A648C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | 5CCED9441EFEAD9B007A648C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 26 | 5CCED9471EFEAD9B007A648C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 5CCED9491EFEAD9B007A648C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 5CCED94C1EFEAD9B007A648C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 5CCED94E1EFEAD9B007A648C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 5CCED9541EFEAE0A007A648C /* UNIXFileSystem.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UNIXFileSystem.framework; path = "../../../../Library/Developer/Xcode/DerivedData/UNIXFileSystem_UNIXFileSystemSample-cqtnzeughulncmbjidcorbwoztub/Build/Products/Debug-iphonesimulator/UNIXFileSystem/UNIXFileSystem.framework"; sourceTree = ""; }; 31 | 64A130732079D43300AED761 /* LICENSE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = LICENSE.md; path = ../LICENSE.md; sourceTree = ""; }; 32 | 64A130742079D43300AED761 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; name = .gitignore; path = ../.gitignore; sourceTree = ""; }; 33 | 64A130752079D43300AED761 /* UNIXFileSystem.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = UNIXFileSystem.podspec; path = ../UNIXFileSystem.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 34 | 64A130762079D43300AED761 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 35 | 92B09539D0E95C3F12C3C6B0 /* Pods-UNIXFileSystem.Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UNIXFileSystem.Sample.release.xcconfig"; path = "Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample.release.xcconfig"; sourceTree = ""; }; 36 | B2F6E6253EAA6E99FDF50D49 /* Pods-UNIXFileSystem.Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UNIXFileSystem.Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample.debug.xcconfig"; sourceTree = ""; }; 37 | B6160BD6554DE33B27227029 /* Pods-UNIXFileSystem UNIXFileSystemSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UNIXFileSystem UNIXFileSystemSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-UNIXFileSystem UNIXFileSystemSample/Pods-UNIXFileSystem UNIXFileSystemSample.release.xcconfig"; sourceTree = ""; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | 5CCED93C1EFEAD9B007A648C /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | 5CCED9551EFEAE0A007A648C /* UNIXFileSystem.framework in Frameworks */, 46 | F9EA4F6E5483A216D91099C9 /* Pods_UNIXFileSystem_Sample.framework in Frameworks */, 47 | ); 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | /* End PBXFrameworksBuildPhase section */ 51 | 52 | /* Begin PBXGroup section */ 53 | 5CCED9361EFEAD9B007A648C = { 54 | isa = PBXGroup; 55 | children = ( 56 | 64A130742079D43300AED761 /* .gitignore */, 57 | 64A130732079D43300AED761 /* LICENSE.md */, 58 | 64A130762079D43300AED761 /* README.md */, 59 | 64A130752079D43300AED761 /* UNIXFileSystem.podspec */, 60 | 5CCED9411EFEAD9B007A648C /* UNIXFileSystem UNIXFileSystemSample */, 61 | 5CCED9401EFEAD9B007A648C /* Products */, 62 | D2C86B83D6A0372A44C38A9A /* Pods */, 63 | 93C33E988B374AA1DC3ABAA9 /* Frameworks */, 64 | ); 65 | sourceTree = ""; 66 | }; 67 | 5CCED9401EFEAD9B007A648C /* Products */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 5CCED93F1EFEAD9B007A648C /* UNIXFileSystem.Sample.app */, 71 | ); 72 | name = Products; 73 | sourceTree = ""; 74 | }; 75 | 5CCED9411EFEAD9B007A648C /* UNIXFileSystem UNIXFileSystemSample */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 5CCED9421EFEAD9B007A648C /* AppDelegate.swift */, 79 | 5CCED9441EFEAD9B007A648C /* ViewController.swift */, 80 | 5CCED9461EFEAD9B007A648C /* Main.storyboard */, 81 | 5CCED9491EFEAD9B007A648C /* Assets.xcassets */, 82 | 5CCED94B1EFEAD9B007A648C /* LaunchScreen.storyboard */, 83 | 5CCED94E1EFEAD9B007A648C /* Info.plist */, 84 | ); 85 | path = "UNIXFileSystem UNIXFileSystemSample"; 86 | sourceTree = ""; 87 | }; 88 | 93C33E988B374AA1DC3ABAA9 /* Frameworks */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 5CCED9541EFEAE0A007A648C /* UNIXFileSystem.framework */, 92 | 3F480A6103B3601D56483DED /* Pods_UNIXFileSystem_UNIXFileSystemSample.framework */, 93 | 0C6D2EFC9659426CD5CC2B73 /* Pods_UNIXFileSystem_Sample.framework */, 94 | ); 95 | name = Frameworks; 96 | sourceTree = ""; 97 | }; 98 | D2C86B83D6A0372A44C38A9A /* Pods */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 51EE8F4BABB8211FA1560CED /* Pods-UNIXFileSystem UNIXFileSystemSample.debug.xcconfig */, 102 | B6160BD6554DE33B27227029 /* Pods-UNIXFileSystem UNIXFileSystemSample.release.xcconfig */, 103 | B2F6E6253EAA6E99FDF50D49 /* Pods-UNIXFileSystem.Sample.debug.xcconfig */, 104 | 92B09539D0E95C3F12C3C6B0 /* Pods-UNIXFileSystem.Sample.release.xcconfig */, 105 | ); 106 | name = Pods; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | 5CCED93E1EFEAD9B007A648C /* UNIXFileSystem.Sample */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = 5CCED9511EFEAD9B007A648C /* Build configuration list for PBXNativeTarget "UNIXFileSystem.Sample" */; 115 | buildPhases = ( 116 | E15AFB736F01D62A44AF3212 /* [CP] Check Pods Manifest.lock */, 117 | 5CCED93B1EFEAD9B007A648C /* Sources */, 118 | 5CCED93C1EFEAD9B007A648C /* Frameworks */, 119 | 5CCED93D1EFEAD9B007A648C /* Resources */, 120 | B3CE5F0772FDCC6F6200EA30 /* [CP] Embed Pods Frameworks */, 121 | ); 122 | buildRules = ( 123 | ); 124 | dependencies = ( 125 | ); 126 | name = UNIXFileSystem.Sample; 127 | productName = "UNIXFileSystem UNIXFileSystemSample"; 128 | productReference = 5CCED93F1EFEAD9B007A648C /* UNIXFileSystem.Sample.app */; 129 | productType = "com.apple.product-type.application"; 130 | }; 131 | /* End PBXNativeTarget section */ 132 | 133 | /* Begin PBXProject section */ 134 | 5CCED9371EFEAD9B007A648C /* Project object */ = { 135 | isa = PBXProject; 136 | attributes = { 137 | LastSwiftUpdateCheck = 0830; 138 | LastUpgradeCheck = 1020; 139 | ORGANIZATIONNAME = Meniny; 140 | TargetAttributes = { 141 | 5CCED93E1EFEAD9B007A648C = { 142 | CreatedOnToolsVersion = 8.3.3; 143 | DevelopmentTeam = 63YL5QDMNS; 144 | LastSwiftMigration = 1020; 145 | ProvisioningStyle = Automatic; 146 | }; 147 | }; 148 | }; 149 | buildConfigurationList = 5CCED93A1EFEAD9B007A648C /* Build configuration list for PBXProject "UNIXFileSystem.Sample" */; 150 | compatibilityVersion = "Xcode 3.2"; 151 | developmentRegion = en; 152 | hasScannedForEncodings = 0; 153 | knownRegions = ( 154 | en, 155 | Base, 156 | ); 157 | mainGroup = 5CCED9361EFEAD9B007A648C; 158 | productRefGroup = 5CCED9401EFEAD9B007A648C /* Products */; 159 | projectDirPath = ""; 160 | projectRoot = ""; 161 | targets = ( 162 | 5CCED93E1EFEAD9B007A648C /* UNIXFileSystem.Sample */, 163 | ); 164 | }; 165 | /* End PBXProject section */ 166 | 167 | /* Begin PBXResourcesBuildPhase section */ 168 | 5CCED93D1EFEAD9B007A648C /* Resources */ = { 169 | isa = PBXResourcesBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | 5CCED94D1EFEAD9B007A648C /* LaunchScreen.storyboard in Resources */, 173 | 5CCED94A1EFEAD9B007A648C /* Assets.xcassets in Resources */, 174 | 5CCED9481EFEAD9B007A648C /* Main.storyboard in Resources */, 175 | ); 176 | runOnlyForDeploymentPostprocessing = 0; 177 | }; 178 | /* End PBXResourcesBuildPhase section */ 179 | 180 | /* Begin PBXShellScriptBuildPhase section */ 181 | B3CE5F0772FDCC6F6200EA30 /* [CP] Embed Pods Frameworks */ = { 182 | isa = PBXShellScriptBuildPhase; 183 | buildActionMask = 2147483647; 184 | files = ( 185 | ); 186 | inputPaths = ( 187 | "${PODS_ROOT}/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-frameworks.sh", 188 | "${BUILT_PRODUCTS_DIR}/UNIXFileSystem/UNIXFileSystem.framework", 189 | ); 190 | name = "[CP] Embed Pods Frameworks"; 191 | outputPaths = ( 192 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UNIXFileSystem.framework", 193 | ); 194 | runOnlyForDeploymentPostprocessing = 0; 195 | shellPath = /bin/sh; 196 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-UNIXFileSystem.Sample/Pods-UNIXFileSystem.Sample-frameworks.sh\"\n"; 197 | showEnvVarsInLog = 0; 198 | }; 199 | E15AFB736F01D62A44AF3212 /* [CP] Check Pods Manifest.lock */ = { 200 | isa = PBXShellScriptBuildPhase; 201 | buildActionMask = 2147483647; 202 | files = ( 203 | ); 204 | inputPaths = ( 205 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 206 | "${PODS_ROOT}/Manifest.lock", 207 | ); 208 | name = "[CP] Check Pods Manifest.lock"; 209 | outputPaths = ( 210 | "$(DERIVED_FILE_DIR)/Pods-UNIXFileSystem.Sample-checkManifestLockResult.txt", 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | shellPath = /bin/sh; 214 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 215 | showEnvVarsInLog = 0; 216 | }; 217 | /* End PBXShellScriptBuildPhase section */ 218 | 219 | /* Begin PBXSourcesBuildPhase section */ 220 | 5CCED93B1EFEAD9B007A648C /* Sources */ = { 221 | isa = PBXSourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | 5CCED9451EFEAD9B007A648C /* ViewController.swift in Sources */, 225 | 5CCED9431EFEAD9B007A648C /* AppDelegate.swift in Sources */, 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | /* End PBXSourcesBuildPhase section */ 230 | 231 | /* Begin PBXVariantGroup section */ 232 | 5CCED9461EFEAD9B007A648C /* Main.storyboard */ = { 233 | isa = PBXVariantGroup; 234 | children = ( 235 | 5CCED9471EFEAD9B007A648C /* Base */, 236 | ); 237 | name = Main.storyboard; 238 | sourceTree = ""; 239 | }; 240 | 5CCED94B1EFEAD9B007A648C /* LaunchScreen.storyboard */ = { 241 | isa = PBXVariantGroup; 242 | children = ( 243 | 5CCED94C1EFEAD9B007A648C /* Base */, 244 | ); 245 | name = LaunchScreen.storyboard; 246 | sourceTree = ""; 247 | }; 248 | /* End PBXVariantGroup section */ 249 | 250 | /* Begin XCBuildConfiguration section */ 251 | 5CCED94F1EFEAD9B007A648C /* Debug */ = { 252 | isa = XCBuildConfiguration; 253 | buildSettings = { 254 | ALWAYS_SEARCH_USER_PATHS = NO; 255 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 256 | CLANG_ANALYZER_NONNULL = YES; 257 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 263 | CLANG_WARN_BOOL_CONVERSION = YES; 264 | CLANG_WARN_COMMA = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 267 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 268 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 269 | CLANG_WARN_EMPTY_BODY = YES; 270 | CLANG_WARN_ENUM_CONVERSION = YES; 271 | CLANG_WARN_INFINITE_RECURSION = YES; 272 | CLANG_WARN_INT_CONVERSION = YES; 273 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 274 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 275 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 278 | CLANG_WARN_STRICT_PROTOTYPES = YES; 279 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 280 | CLANG_WARN_UNREACHABLE_CODE = YES; 281 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 282 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 283 | COPY_PHASE_STRIP = NO; 284 | DEBUG_INFORMATION_FORMAT = dwarf; 285 | ENABLE_STRICT_OBJC_MSGSEND = YES; 286 | ENABLE_TESTABILITY = YES; 287 | GCC_C_LANGUAGE_STANDARD = gnu99; 288 | GCC_DYNAMIC_NO_PIC = NO; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_OPTIMIZATION_LEVEL = 0; 291 | GCC_PREPROCESSOR_DEFINITIONS = ( 292 | "DEBUG=1", 293 | "$(inherited)", 294 | ); 295 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 296 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 297 | GCC_WARN_UNDECLARED_SELECTOR = YES; 298 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 299 | GCC_WARN_UNUSED_FUNCTION = YES; 300 | GCC_WARN_UNUSED_VARIABLE = YES; 301 | MTL_ENABLE_DEBUG_INFO = YES; 302 | ONLY_ACTIVE_ARCH = YES; 303 | SDKROOT = iphoneos; 304 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 305 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 306 | TARGETED_DEVICE_FAMILY = "1,2"; 307 | }; 308 | name = Debug; 309 | }; 310 | 5CCED9501EFEAD9B007A648C /* Release */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 322 | CLANG_WARN_BOOL_CONVERSION = YES; 323 | CLANG_WARN_COMMA = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 327 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 334 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 337 | CLANG_WARN_STRICT_PROTOTYPES = YES; 338 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 344 | ENABLE_NS_ASSERTIONS = NO; 345 | ENABLE_STRICT_OBJC_MSGSEND = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_NO_COMMON_BLOCKS = YES; 348 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | MTL_ENABLE_DEBUG_INFO = NO; 355 | SDKROOT = iphoneos; 356 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | VALIDATE_PRODUCT = YES; 359 | }; 360 | name = Release; 361 | }; 362 | 5CCED9521EFEAD9B007A648C /* Debug */ = { 363 | isa = XCBuildConfiguration; 364 | baseConfigurationReference = B2F6E6253EAA6E99FDF50D49 /* Pods-UNIXFileSystem.Sample.debug.xcconfig */; 365 | buildSettings = { 366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 367 | DEVELOPMENT_TEAM = 63YL5QDMNS; 368 | INFOPLIST_FILE = "UNIXFileSystem UNIXFileSystemSample/Info.plist"; 369 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 370 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 371 | PRODUCT_BUNDLE_IDENTIFIER = cn.meniny.UNIXFileSystem.Sample; 372 | PRODUCT_NAME = "$(TARGET_NAME)"; 373 | SWIFT_VERSION = 5.0; 374 | }; 375 | name = Debug; 376 | }; 377 | 5CCED9531EFEAD9B007A648C /* Release */ = { 378 | isa = XCBuildConfiguration; 379 | baseConfigurationReference = 92B09539D0E95C3F12C3C6B0 /* Pods-UNIXFileSystem.Sample.release.xcconfig */; 380 | buildSettings = { 381 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 382 | DEVELOPMENT_TEAM = 63YL5QDMNS; 383 | INFOPLIST_FILE = "UNIXFileSystem UNIXFileSystemSample/Info.plist"; 384 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 386 | PRODUCT_BUNDLE_IDENTIFIER = cn.meniny.UNIXFileSystem.Sample; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | SWIFT_VERSION = 5.0; 389 | }; 390 | name = Release; 391 | }; 392 | /* End XCBuildConfiguration section */ 393 | 394 | /* Begin XCConfigurationList section */ 395 | 5CCED93A1EFEAD9B007A648C /* Build configuration list for PBXProject "UNIXFileSystem.Sample" */ = { 396 | isa = XCConfigurationList; 397 | buildConfigurations = ( 398 | 5CCED94F1EFEAD9B007A648C /* Debug */, 399 | 5CCED9501EFEAD9B007A648C /* Release */, 400 | ); 401 | defaultConfigurationIsVisible = 0; 402 | defaultConfigurationName = Release; 403 | }; 404 | 5CCED9511EFEAD9B007A648C /* Build configuration list for PBXNativeTarget "UNIXFileSystem.Sample" */ = { 405 | isa = XCConfigurationList; 406 | buildConfigurations = ( 407 | 5CCED9521EFEAD9B007A648C /* Debug */, 408 | 5CCED9531EFEAD9B007A648C /* Release */, 409 | ); 410 | defaultConfigurationIsVisible = 0; 411 | defaultConfigurationName = Release; 412 | }; 413 | /* End XCConfigurationList section */ 414 | }; 415 | rootObject = 5CCED9371EFEAD9B007A648C /* Project object */; 416 | } 417 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Sample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 3 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 5CCED93E1EFEAD9B007A648C 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcodeproj/xcuserdata/elias.xcuserdatad/xcschemes/UNIXFileSystemSample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcodeproj/xcuserdata/elias.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | UNIXFileSystemSample.xcscheme 8 | 9 | orderHint 10 | 2 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcworkspace/xcuserdata/Meniny.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meniny/UNIXFileSystem/dcfa49365671160596e43b43acad28f04db0deef/Sample/UNIXFileSystem.Sample.xcworkspace/xcuserdata/Meniny.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Sample/UNIXFileSystem.Sample.xcworkspace/xcuserdata/elias.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meniny/UNIXFileSystem/dcfa49365671160596e43b43acad28f04db0deef/Sample/UNIXFileSystem.Sample.xcworkspace/xcuserdata/elias.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /UNIXFileSystem.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'UNIXFileSystem' 3 | s.summary = 'UNIXFileSystem is an UNIX file system framework for iOS/macOS/tvOS/watchOS platforms.' 4 | s.version = '2.3.0' 5 | s.homepage = 'https://github.com/Meniny/UNIXFileSystem' 6 | s.license = 'MIT' 7 | s.author = { "Meniny" => "Meniny@qq.com" } 8 | s.source = { :git => "https://github.com/Meniny/UNIXFileSystem.git", :tag => s.version.to_s } 9 | s.social_media_url = 'https://meniny.cn/' 10 | 11 | s.swift_version = '5' 12 | 13 | s.ios.deployment_target = '8.0' 14 | s.osx.deployment_target = '10.10' 15 | s.tvos.deployment_target = '9.0' 16 | s.watchos.deployment_target = '2.0' 17 | 18 | s.source_files = 'UNIXFileSystem/Source/*.swift' 19 | s.requires_arc = true 20 | s.frameworks = 'Foundation' 21 | end 22 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/AliasFile.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSAliasFile.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSAliasFile` is a `struct` that is used to represent an alias. 12 | public struct UFSAliasFile: UFSFile { 13 | /// The path of the alias file. 14 | public var path: UFSPath 15 | 16 | /// Creates a `UFSAliasFile` instance with the specified path. 17 | /// 18 | /// - parameter path: The path for the alias file. 19 | /// 20 | /// - returns: A new `UFSAliasFile` instance or nil if the `UFSAliasFile` does not exist at the specified path. 21 | public init?(path: UFSPath) { 22 | do { 23 | let resourceValues = try path.url.resourceValues(forKeys: [.isAliasFileKey]) 24 | 25 | if let isAliasFile = resourceValues.isAliasFile, isAliasFile { 26 | self.init(path: path) 27 | } else { 28 | return nil 29 | } 30 | 31 | } catch _ { 32 | return nil 33 | } 34 | } 35 | 36 | /// Creates a `UFSAliasFile` instance with the specified path. 37 | /// 38 | /// - parameter path: The path for the alias file. 39 | /// 40 | /// - returns: A new `UFSAliasFile` instance. 41 | public init(_ path: UFSPath) { 42 | self.path = path 43 | } 44 | 45 | /// Returns an `UFSAliasable` destination if `path` is a valid alias, otherise throws an `Error`. 46 | /// 47 | /// - throws: a `URLError`. 48 | /// 49 | /// - returns: An `UFSAliasable`. 50 | public func destination() throws -> UFSAliasable { 51 | let destinationURL = try NSURL(resolvingAliasFileAt: self.path.url, options: []) as URL 52 | if let destination = UFSPath(destinationURL).item as? UFSAliasable { 53 | return destination 54 | } else { 55 | throw URLError(.fileDoesNotExist) 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Aliasable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSAliasable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 04/11/2016. 6 | // 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSAliasable` `protocol` for an `UFSItem` that can be aliased. 12 | public protocol UFSAliasable: UFSItem { } 13 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Copyable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSCopyable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSCopyable` `protocol` for an `UFSItem` that can be a copied. 12 | public protocol UFSCopyable: UFSItem { 13 | /// Copies the instance of the conforming type to the specified path, returning the copy. 14 | func copy(to path: UFSPath) throws -> Self 15 | } 16 | 17 | extension UFSCopyable { 18 | /// Returns a copy of the `UFSItem` at the specified `UFSPath`. 19 | /// 20 | /// - parameter path: The path to copy the item too. 21 | /// 22 | /// - throws: An `Error`. 23 | /// 24 | /// - returns: A copy of the item. 25 | public func copy(to path: UFSPath) throws -> Self { 26 | try FileManager.default.copyItem(at: self.path.url, to: path.url) 27 | return path.item! as! Self 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/CopyableSubitem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSCopyableSubitem.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSCopyableSubitem` `protocol` for an `UFSItem` that adopts `UFSCopyable` and `UFSSubitem`. 12 | public protocol UFSCopyableSubitem: UFSCopyable, UFSSubitem { 13 | /// Copies the instance of the conforming type into the specified parent, returning the copy. 14 | func copy(into parent: UFSParent) throws -> Self 15 | } 16 | 17 | extension UFSCopyableSubitem { 18 | /// Copy the `UFSItem` into the the specified `UFSParent`. 19 | /// 20 | /// - parameter parent: The parent to copy the item into. 21 | /// 22 | /// - throws: An `Error`. 23 | /// 24 | /// - returns: A copy of the item. 25 | public func copy(into parent: UFSParent) throws -> Self { 26 | let copyPath = parent.path.appendingComponent(path.lastComponent) 27 | return try copy(to: copyPath) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Directory.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSDirectory.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/09/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSDirectory` is a `struct` that is used to represent a directory. 12 | public struct UFSDirectory: UFSItem, UFSParent, UFSSubitem, UFSCopyable, UFSCopyableSubitem, UFSMoveable, UFSMoveableSubitem, UFSRenameable, UFSRemoveable, UFSTrashable, UFSSymbolicLinkable, UFSFileWrapperConvertible { 13 | /// The path of the directory. 14 | public var path: UFSPath 15 | 16 | /// Creates a `UFSDirectory` instance with the specified path. 17 | /// 18 | /// - parameter path: The path for the directory. 19 | /// 20 | /// - returns: A new `UFSDirectory` instance or nil if the `UFSDirectory` does not exist at the specified path. 21 | public init?(path: UFSPath) { 22 | do { 23 | let resourceValues = try path.url.resourceValues(forKeys: [.isDirectoryKey]) 24 | 25 | if let isDirectory = resourceValues.isDirectory, isDirectory { 26 | self.init(path: path) 27 | } else { 28 | return nil 29 | } 30 | 31 | } catch _ { 32 | return nil 33 | } 34 | } 35 | 36 | /// Creates a `UFSDirectory` instance with the specified path. 37 | /// 38 | /// - parameter path: The path for the directory. 39 | /// 40 | /// - returns: A new `UFSDirectory` instance. 41 | public init(_ path: UFSPath) { 42 | self.path = path 43 | } 44 | 45 | /// Returns a Root `UFSDirectory`. 46 | public static var root: UFSDirectory { 47 | return UFSDirectory(UFSPath.root) 48 | } 49 | 50 | /// Returns a Temporary `UFSDirectory`. 51 | @available(iOS 10.0, tvOS 10.0, watchOS 3.0, macOS 10.12, *) 52 | public static var temporary: UFSDirectory { 53 | let url = FileManager.default.temporaryDirectory 54 | return UFSDirectory(UFSPath(url)) 55 | } 56 | 57 | /// Returns the Document `UFSDirectory` in the current users home directory. 58 | public static var document: UFSDirectory { 59 | let documentUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! 60 | return UFSDirectory(UFSPath(documentUrl)) 61 | } 62 | 63 | /// Returns the Library `UFSDirectory` in the current users home directory. 64 | public static var library: UFSDirectory { 65 | let libraryUrl = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask).first! 66 | return UFSDirectory(UFSPath(libraryUrl)) 67 | } 68 | 69 | /// Returns the Caches `UFSDirectory` in the current users home directory. 70 | public static var caches: UFSDirectory { 71 | let cachesUrl = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first! 72 | return UFSDirectory(UFSPath(cachesUrl)) 73 | } 74 | 75 | /// Returns the Application(s) `UFSDirectory` in the current users home directory. 76 | public static var application: UFSDirectory { 77 | let applicationUrl = FileManager.default.urls(for: .applicationDirectory, in: .userDomainMask).first! 78 | return UFSDirectory(UFSPath(applicationUrl)) 79 | } 80 | 81 | /// Returns the Application Support UFSDirectory in the current users home directory. 82 | public static var applicationSupport: UFSDirectory { 83 | let applicationSupportUrl = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! 84 | return UFSDirectory(UFSPath(applicationSupportUrl)) 85 | } 86 | 87 | /// Returns the Desktop `UFSDirectory` in the current users home directory. 88 | public static var desktop: UFSDirectory { 89 | let desktopUrl = FileManager.default.urls(for: .desktopDirectory, in: .userDomainMask).first! 90 | return UFSDirectory(UFSPath(desktopUrl)) 91 | } 92 | 93 | /// Returns the Downloads `UFSDirectory` in the current users home directory. 94 | public static var downloads: UFSDirectory { 95 | let downloadsUrl = FileManager.default.urls(for: .downloadsDirectory, in: .userDomainMask).first! 96 | return UFSDirectory(UFSPath(downloadsUrl)) 97 | } 98 | 99 | /// Returns the Movies `UFSDirectory` in the current users home directory. 100 | public static var movies: UFSDirectory { 101 | let moviesUrl = FileManager.default.urls(for: .moviesDirectory, in: .userDomainMask).first! 102 | return UFSDirectory(UFSPath(moviesUrl)) 103 | } 104 | 105 | /// Returns the Music `UFSDirectory` in the current users home directory. 106 | public static var music: UFSDirectory { 107 | let musicUrl = FileManager.default.urls(for: .moviesDirectory, in: .userDomainMask).first! 108 | return UFSDirectory(UFSPath(musicUrl)) 109 | } 110 | 111 | /// Returns the Pictures `UFSDirectory` in the current users home directory. 112 | public static var pictures: UFSDirectory { 113 | let picturesUrl = FileManager.default.urls(for: .picturesDirectory, in: .userDomainMask).first! 114 | return UFSDirectory(UFSPath(picturesUrl)) 115 | } 116 | 117 | /// Returns all directories where applications can be stored in the current users home directory. 118 | public static var applications: [UFSDirectory] { 119 | let applicationUrls = FileManager.default.urls(for: .allApplicationsDirectory, in: .userDomainMask) 120 | return applicationUrls.map( { UFSDirectory(UFSPath($0)) } ) 121 | } 122 | 123 | /// Returns all libaries where applications can be stored in the current users home directory. 124 | public static var libraries: [UFSDirectory] { 125 | let libraryUrls = FileManager.default.urls(for: .allLibrariesDirectory, in: .userDomainMask) 126 | return libraryUrls.map( { UFSDirectory(UFSPath($0)) } ) 127 | } 128 | 129 | /// Creates and returns a `UFSDirectory` at the specified path 130 | /// 131 | /// - parameter path: The path to create a directory at. 132 | /// - parameter withIntermediateDirectories: Passing `true` for withIntermediateDirectories will create any necessary intermediate directories. 133 | /// - parameter attributes: The file attributes for the new directory. You can set the owner and group numbers, file permissions, and modification date. If you specify nil for this parameter, the directory is created according to the umask(2) macOS Developer Tools Manual Page of the process. 134 | /// 135 | /// - throws: An `Error`. 136 | /// 137 | /// - returns: A `UFSDirectory` or throws an `Error`. 138 | @discardableResult public static func create(at path: UFSPath, withIntermediateDirectories: Bool = false, attributes: [FileAttributeKey: Any]? = nil) throws -> UFSDirectory { 139 | try FileManager.default.createDirectory(at: path.url, withIntermediateDirectories: withIntermediateDirectories, attributes: attributes) 140 | return UFSDirectory(path) 141 | } 142 | 143 | /// Returns the container directory associated with the specified security application group identifier. 144 | /// 145 | /// - note: This function also creates the directory if it does not yet exist. 146 | /// 147 | /// - parameter groupIdentifier: the security application group identifier. 148 | /// 149 | /// - returns: A container `UFSDirectory` or nil if the container is not valid. 150 | public static func container(forSecurityApplicationGroupIdentifier groupIdentifier: String) -> UFSDirectory? { 151 | guard let containerUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: groupIdentifier) else { 152 | return nil 153 | } 154 | return UFSDirectory(UFSPath(containerUrl)) 155 | } 156 | 157 | #if os(macOS) 158 | /// Returns the home `UFSDirectory` for the current user. 159 | /// 160 | /// - returns: A `UFSDirectory`. 161 | @available(macOS 10.12, *) 162 | public static var home: UFSDirectory { 163 | let url = FileManager.default.homeDirectoryForCurrentUser 164 | return UFSDirectory(UFSPath(url)) 165 | } 166 | 167 | /// Returns the home `UFSDirectory` for the specified user. 168 | /// 169 | /// - parameter user: The user for the home directory. 170 | /// 171 | /// - returns: A `UFSDirectory` or nil if there is no home directory for the specified user. 172 | @available(macOS 10.12, *) 173 | public static func home(forUser user: String) -> UFSDirectory? { 174 | guard let url = FileManager.default.homeDirectory(forUser: user) else { 175 | return nil 176 | } 177 | return UFSDirectory(UFSPath(url)) 178 | } 179 | #endif 180 | 181 | /// Returns the `FileManager.URLRelationship` compared to another item. 182 | /// 183 | /// - parameter item: The item to compare too. 184 | /// 185 | /// - throws: An `Error`. 186 | /// 187 | /// - returns: A `FileManager.URLRelationship`. 188 | public func relationship(to item: UFSItem) throws -> FileManager.URLRelationship { 189 | var urlRelationship: FileManager.URLRelationship = .other 190 | try FileManager.default.getRelationship(&urlRelationship, ofDirectoryAt: path.url, toItemAt: item.path.url) 191 | return urlRelationship 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/File.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSFile.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/09/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSFile` is the base `protocol` for a single file. 12 | //public protocol UFSFile: UFSItem, UFSSubitem, UFSCopyable, UFSCopyableSubitem, UFSMoveable, UFSMoveableSubitem, UFSRenameable, UFSRemoveable, UFSTrashable, UFSLinkable, UFSSymbolicLinkable, UFSAliasable {} 13 | 14 | public protocol UFSFile: UFSCopyableSubitem, UFSMoveableSubitem, UFSRenameable, UFSRemoveable, UFSTrashable, UFSLinkable, UFSSymbolicLinkable, UFSAliasable {} 15 | 16 | extension UFSFile { 17 | /// Returns wether the contents of the specified files are equal. 18 | public func isContentEqual(to file: Self) -> Bool { 19 | return FileManager.default.contentsEqual(atPath: path.rawValue, andPath: file.path.rawValue) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/FileHandleConvertible.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSFileHandleConvertible.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 03/11/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSFileHandleConvertible` `protocol` for an `UFSItem` that can be converted into a `FileHandle` for either reading, writing or updating (both reading and writing). 12 | public protocol UFSFileHandleConvertible: UFSItem { 13 | /// Returns a file handle for reading instantiated with the instance of the conforming type. 14 | func fileHandleForReading() throws -> FileHandle 15 | /// Returns a file handle for writing instantiated with the instance of the conforming type. 16 | func fileHandleForWriting() throws -> FileHandle 17 | /// Returns a file handle for updating instantiated with the instance of the conforming type. 18 | func fileHandleForUpdating() throws -> FileHandle 19 | } 20 | 21 | extension UFSFileHandleConvertible { 22 | /// Returns a `FileHandle` for Reading. 23 | /// 24 | /// - throws: An `Error`. 25 | /// 26 | /// - returns: A `FileHandle` for reading. 27 | public func fileHandleForReading() throws -> FileHandle { 28 | return try FileHandle(forReadingFrom: path.url) 29 | } 30 | 31 | /// Returns a `FileHandle` for Writing. 32 | /// 33 | /// - throws: An `Error`. 34 | /// 35 | /// - returns: A `FileHandle` for writing. 36 | public func fileHandleForWriting() throws -> FileHandle { 37 | return try FileHandle(forWritingTo: path.url) 38 | } 39 | 40 | /// Returns a `FileHandle` for Updating. 41 | /// 42 | /// - throws: An `Error`. 43 | /// 44 | /// - returns: A `FileHandle` for updating (both reading and writing). 45 | public func fileHandleForUpdating() throws -> FileHandle { 46 | return try FileHandle(forUpdating: path.url) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/FileWrapperConvertible.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSFileWrapperConvertible.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 02/11/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public typealias UFSFileWrapper = FileWrapper 12 | 13 | /// `UFSFileWrapperConvertible` `protocol` for an `UFSItem` that can be converted into a `UFSFileWrapper`. 14 | public protocol UFSFileWrapperConvertible: UFSItem { 15 | /// Returns a file wrapper instantiated with the instance of the conforming type. 16 | func fileWrapper() throws -> UFSFileWrapper 17 | } 18 | 19 | extension UFSFileWrapperConvertible { 20 | /// Returns a `UFSFileWrapper` for the `UFSItem`. 21 | /// 22 | /// - throws: An `Error`. 23 | /// 24 | /// - returns: A `UFSFileWrapper`. 25 | public func fileWrapper() throws -> UFSFileWrapper { 26 | return try UFSFileWrapper(url: path.url, options: []) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Item.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSItem.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/09/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSItem` is the base `protocol` for all file system items that can be represented by `UFSPath`. 12 | public protocol UFSItem: UFSPathRepresentable, CustomStringConvertible, CustomDebugStringConvertible { 13 | /// The path representing the instance of the conforming type. 14 | var path: UFSPath { get set } 15 | 16 | /// Instantiates an instance of the conforming type from a path representation without validating the path. 17 | init(_ path: UFSPath) 18 | } 19 | 20 | public extension UFSItem /* CustomStringConvertible*/ { 21 | /// A textual representation of this instance, returning the represented path's `rawValue`. 22 | var description: String { 23 | return path.description 24 | } 25 | } 26 | 27 | public extension UFSItem /* CustomDebugStringConvertible */ { 28 | /// A textual representation of this instance. 29 | var debugDescription: String { 30 | return "\(type(of: self)) \(path.rawValue)" 31 | } 32 | } 33 | 34 | public extension UFSItem { 35 | 36 | /// Returns if the item exists. 37 | func exists() -> Bool { 38 | return path.exists 39 | } 40 | 41 | /// Returns if the item is a directory. 42 | func isDirectory() -> Bool { 43 | return path.isDirectory 44 | } 45 | 46 | /// Returns if the item's localized name. 47 | func localizedName() throws -> String { 48 | let values = try path.url.resourceValues(forKeys: [.localizedNameKey]) 49 | return values.localizedName! 50 | } 51 | 52 | /// Returns if the item is readable. 53 | func isReadable() throws -> Bool { 54 | let values = try path.url.resourceValues(forKeys: [.isReadableKey]) 55 | return values.isReadable! 56 | } 57 | 58 | /// Returns if the item is writebale. 59 | func isWritable() throws -> Bool { 60 | let values = try path.url.resourceValues(forKeys: [.isWritableKey]) 61 | return values.isWritable! 62 | } 63 | 64 | /// Returns if the item is executable. 65 | func isExecutable() throws -> Bool { 66 | let values = try path.url.resourceValues(forKeys: [.isExecutableKey]) 67 | return values.isExecutable! 68 | } 69 | 70 | /// Returns if the item is hidden. 71 | func isHidden() throws -> Bool { 72 | let values = try path.url.resourceValues(forKeys: [.isHiddenKey]) 73 | return values.isHidden! 74 | } 75 | 76 | /// Returns if the item is a package. 77 | func isPackage() throws -> Bool { 78 | let values = try path.url.resourceValues(forKeys: [.isPackageKey]) 79 | return values.isPackage! 80 | } 81 | 82 | /// Returns if the item is a application. 83 | @available(iOS 9.0, tvOS 9.0, watchOS 2.0, macOS 10.11, *) 84 | func isApplication() throws -> Bool { 85 | let values = try path.url.resourceValues(forKeys: [.isApplicationKey]) 86 | return values.isApplication! 87 | } 88 | 89 | /// Returns if the item is a alias file. 90 | func isAliasFile() throws -> Bool { 91 | let values = try path.url.resourceValues(forKeys: [.isAliasFileKey]) 92 | return values.isAliasFile! 93 | } 94 | 95 | /// Returns if the item is a symbolic link. 96 | func isSymbolicLink() throws -> Bool { 97 | let values = try path.url.resourceValues(forKeys: [.isSymbolicLinkKey]) 98 | return values.isSymbolicLink! 99 | } 100 | 101 | /// Returns if the item's creation date. 102 | func creationDate() throws -> Date { 103 | let values = try path.url.resourceValues(forKeys: [.creationDateKey]) 104 | return values.creationDate! 105 | } 106 | 107 | /// Returns if the item's content access date. 108 | func contentAccessDate() throws -> Date { 109 | let values = try path.url.resourceValues(forKeys: [.contentAccessDateKey]) 110 | return values.contentAccessDate! 111 | } 112 | 113 | /// Returns if the item's content modification date. 114 | func contentModificationDate() throws -> Date { 115 | let values = try path.url.resourceValues(forKeys: [.contentModificationDateKey]) 116 | return values.contentModificationDate! 117 | } 118 | 119 | /// Returns if the item's attribute modification date. 120 | func attributeModificationDate() throws -> Date { 121 | let values = try path.url.resourceValues(forKeys: [.attributeModificationDateKey]) 122 | return values.attributeModificationDate! 123 | } 124 | 125 | /// Returns files attributes for the item 126 | /// 127 | /// - note: This function does not transverse symbolic links. 128 | /// 129 | /// - throws: An `Error`. 130 | /// 131 | /// - returns: attibutes 132 | func attributes() throws -> [FileAttributeKey: Any] { 133 | return try FileManager.default.attributesOfItem(atPath: path.rawValue) 134 | } 135 | 136 | /// Returns file attributes for the item 137 | /// 138 | /// - parameter attributes: The attributes to set on the item. 139 | /// 140 | /// - throws: An `Error`. 141 | func setAttributes(_ attributes: [FileAttributeKey: Any]) throws { 142 | return try FileManager.default.setAttributes(attributes, ofItemAtPath: path.rawValue) 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Linkable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSLinkable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSLinkable` `protocol` for an `UFSItem` that can be hard linked to a `UFSPath`. 12 | public protocol UFSLinkable: UFSItem { 13 | /// Links the instance of the conforming type to the specified path, returning the link. 14 | func link(to path: UFSPath) throws -> UFSLinkable 15 | } 16 | 17 | extension UFSLinkable { 18 | /// Link the `UFSItem` to the specified `UFSPath`. 19 | /// 20 | /// - parameter path: The path to link to. 21 | /// 22 | /// - throws: An `Error`. 23 | /// 24 | /// - returns: the created `UFSLinkable`. 25 | public func link(to path: UFSPath) throws -> UFSLinkable { 26 | try FileManager.default.linkItem(at: self.path.url, to: path.url) 27 | return path.item as! UFSLinkable 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/MIMEType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MIMEType.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/09/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | fileprivate let DEFAULT_MIME_TYPE = "application/octet-stream" 12 | public enum UFSFileExtension: String { 13 | case html = "html" 14 | case htm = "htm" 15 | case shtml = "shtml" 16 | case css = "css" 17 | case xml = "xml" 18 | case gif = "gif" 19 | case jpeg = "jpeg" 20 | case jpg = "jpg" 21 | case js = "js" 22 | case atom = "atom" 23 | case rss = "rss" 24 | case mml = "mml" 25 | case txt = "txt" 26 | case jad = "jad" 27 | case wml = "wml" 28 | case htc = "htc" 29 | case png = "png" 30 | case tif = "tif" 31 | case tiff = "tiff" 32 | case wbmp = "wbmp" 33 | case ico = "ico" 34 | case jng = "jng" 35 | case bmp = "bmp" 36 | case svg = "svg" 37 | case svgz = "svgz" 38 | case webp = "webp" 39 | case woff = "woff" 40 | case jar = "jar" 41 | case war = "war" 42 | case ear = "ear" 43 | case json = "json" 44 | case hqx = "hqx" 45 | case doc = "doc" 46 | case pdf = "pdf" 47 | case ps = "ps" 48 | case eps = "eps" 49 | case ai = "ai" 50 | case rtf = "rtf" 51 | case m3u8 = "m3u8" 52 | case xls = "xls" 53 | case eot = "eot" 54 | case ppt = "ppt" 55 | case wmlc = "wmlc" 56 | case kml = "kml" 57 | case kmz = "kmz" 58 | case sevenz = "7z" 59 | case cco = "cco" 60 | case jardiff = "jardiff" 61 | case jnlp = "jnlp" 62 | case run = "run" 63 | case pl = "pl" 64 | case pm = "pm" 65 | case prc = "prc" 66 | case pdb = "pdb" 67 | case rar = "rar" 68 | case rpm = "rpm" 69 | case sea = "sea" 70 | case swf = "swf" 71 | case sit = "sit" 72 | case tcl = "tcl" 73 | case tk = "tk" 74 | case der = "der" 75 | case pem = "pem" 76 | case crt = "crt" 77 | case xpi = "xpi" 78 | case xhtml = "xhtml" 79 | case xspf = "xspf" 80 | case zip = "zip" 81 | case bin = "bin" 82 | case exe = "exe" 83 | case dll = "dll" 84 | case deb = "deb" 85 | case dmg = "dmg" 86 | case iso = "iso" 87 | case img = "img" 88 | case msi = "msi" 89 | case msp = "msp" 90 | case msm = "msm" 91 | case docx = "docx" 92 | case xlsx = "xlsx" 93 | case pptx = "pptx" 94 | case mid = "mid" 95 | case midi = "midi" 96 | case kar = "kar" 97 | case mp3 = "mp3" 98 | case ogg = "ogg" 99 | case m4a = "m4a" 100 | case ra = "ra" 101 | case threegpp = "3gpp" 102 | case threegp = "3gp" 103 | case ts = "ts" 104 | case mp4 = "mp4" 105 | case mpeg = "mpeg" 106 | case mpg = "mpg" 107 | case mov = "mov" 108 | case webm = "webm" 109 | case flv = "flv" 110 | case m4v = "m4v" 111 | case mng = "mng" 112 | case asx = "asx" 113 | case asf = "asf" 114 | case wmv = "wmv" 115 | case avi = "avi" 116 | 117 | public var mimeType: String { 118 | switch self { 119 | case .html: return "text/html" 120 | case .htm: return "text/html" 121 | case .shtml: return "text/html" 122 | case .css: return "text/css" 123 | case .xml: return "text/xml" 124 | case .gif: return "image/gif" 125 | case .jpeg: return "image/jpeg" 126 | case .jpg: return "image/jpeg" 127 | case .js: return "application/javascript" 128 | case .atom: return "application/atom+xml" 129 | case .rss: return "application/rss+xml" 130 | case .mml: return "text/mathml" 131 | case .txt: return "text/plain" 132 | case .jad: return "text/vnd.sun.j2me.app-descriptor" 133 | case .wml: return "text/vnd.wap.wml" 134 | case .htc: return "text/x-component" 135 | case .png: return "image/png" 136 | case .tif: return "image/tiff" 137 | case .tiff: return "image/tiff" 138 | case .wbmp: return "image/vnd.wap.wbmp" 139 | case .ico: return "image/x-icon" 140 | case .jng: return "image/x-jng" 141 | case .bmp: return "image/x-ms-bmp" 142 | case .svg: return "image/svg+xml" 143 | case .svgz: return "image/svg+xml" 144 | case .webp: return "image/webp" 145 | case .woff: return "application/font-woff" 146 | case .jar: return "application/java-archive" 147 | case .war: return "application/java-archive" 148 | case .ear: return "application/java-archive" 149 | case .json: return "application/json" 150 | case .hqx: return "application/mac-binhex40" 151 | case .doc: return "application/msword" 152 | case .pdf: return "application/pdf" 153 | case .ps: return "application/postscript" 154 | case .eps: return "application/postscript" 155 | case .ai: return "application/postscript" 156 | case .rtf: return "application/rtf" 157 | case .m3u8: return "application/vnd.apple.mpegurl" 158 | case .xls: return "application/vnd.ms-excel" 159 | case .eot: return "application/vnd.ms-fontobject" 160 | case .ppt: return "application/vnd.ms-powerpoint" 161 | case .wmlc: return "application/vnd.wap.wmlc" 162 | case .kml: return "application/vnd.google-earth.kml+xml" 163 | case .kmz: return "application/vnd.google-earth.kmz" 164 | case .sevenz: return "application/x-7z-compressed" 165 | case .cco: return "application/x-cocoa" 166 | case .jardiff: return "application/x-java-archive-diff" 167 | case .jnlp: return "application/x-java-jnlp-file" 168 | case .run: return "application/x-makeself" 169 | case .pl: return "application/x-perl" 170 | case .pm: return "application/x-perl" 171 | case .prc: return "application/x-pilot" 172 | case .pdb: return "application/x-pilot" 173 | case .rar: return "application/x-rar-compressed" 174 | case .rpm: return "application/x-redhat-package-manager" 175 | case .sea: return "application/x-sea" 176 | case .swf: return "application/x-shockwave-flash" 177 | case .sit: return "application/x-stuffit" 178 | case .tcl: return "application/x-tcl" 179 | case .tk: return "application/x-tcl" 180 | case .der: return "application/x-x509-ca-cert" 181 | case .pem: return "application/x-x509-ca-cert" 182 | case .crt: return "application/x-x509-ca-cert" 183 | case .xpi: return "application/x-xpinstall" 184 | case .xhtml: return "application/xhtml+xml" 185 | case .xspf: return "application/xspf+xml" 186 | case .zip: return "application/zip" 187 | case .bin: return "application/octet-stream" 188 | case .exe: return "application/octet-stream" 189 | case .dll: return "application/octet-stream" 190 | case .deb: return "application/octet-stream" 191 | case .dmg: return "application/octet-stream" 192 | case .iso: return "application/octet-stream" 193 | case .img: return "application/octet-stream" 194 | case .msi: return "application/octet-stream" 195 | case .msp: return "application/octet-stream" 196 | case .msm: return "application/octet-stream" 197 | case .docx: return "application/vnd.openxmlformats-officedocument.wordprocessingml.document" 198 | case .xlsx: return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" 199 | case .pptx: return "application/vnd.openxmlformats-officedocument.presentationml.presentation" 200 | case .mid: return "audio/midi" 201 | case .midi: return "audio/midi" 202 | case .kar: return "audio/midi" 203 | case .mp3: return "audio/mpeg" 204 | case .ogg: return "audio/ogg" 205 | case .m4a: return "audio/x-m4a" 206 | case .ra: return "audio/x-realaudio" 207 | case .threegpp: return "video/3gpp" 208 | case .threegp: return "video/3gpp" 209 | case .ts: return "video/mp2t" 210 | case .mp4: return "video/mp4" 211 | case .mpeg: return "video/mpeg" 212 | case .mpg: return "video/mpeg" 213 | case .mov: return "video/quicktime" 214 | case .webm: return "video/webm" 215 | case .flv: return "video/x-flv" 216 | case .m4v: return "video/x-m4v" 217 | case .mng: return "video/x-mng" 218 | case .asx: return "video/x-ms-asf" 219 | case .asf: return "video/x-ms-asf" 220 | case .wmv: return "video/x-ms-wmv" 221 | case .avi: return "video/x-msvideo" 222 | } 223 | } 224 | } 225 | 226 | public extension UFSFile { 227 | var mimeType: String { 228 | return UFSFileExtension.init(rawValue: self.path.pathExtension)?.mimeType ?? DEFAULT_MIME_TYPE 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Moveable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSMoveable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSMoveable` `protocol` for an `UFSItem` that can be moved to another `UFSPath`. 12 | public protocol UFSMoveable: UFSItem { 13 | /// Moves the instance of the conforming type to the specified path. 14 | mutating func move(to path: UFSPath) throws 15 | } 16 | 17 | extension UFSMoveable { 18 | /// Move the `UFSItem` to the specified `UFSPath`. 19 | /// 20 | /// - parameter path: The path to move the item too. 21 | /// 22 | /// - throws: An `Error`. 23 | mutating public func move(to path: UFSPath) throws { 24 | try FileManager.default.moveItem(at: self.path.url, to: path.url) 25 | self.path = path 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/MoveableSubitem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSMoveableSubitem.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSMoveableSubitem` `protocol` for an `UFSItem` that adopts `UFSMoveable` and `UFSSubitem`. 12 | public protocol UFSMoveableSubitem: UFSMoveable, UFSSubitem { 13 | /// Moves the instance of the conforming type into the specified parent. 14 | mutating func move(into parent: UFSParent) throws 15 | } 16 | 17 | extension UFSMoveableSubitem { 18 | /// Move the `UFSItem` into the specified `UFSParent`. 19 | /// 20 | /// - parameter parent: The parent to move the item into. 21 | /// 22 | /// - throws: An `Error`. 23 | mutating public func move(into parent: UFSParent) throws { 24 | let movePath = parent.path.appendingComponent(path.lastComponent) 25 | try move(to: movePath) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Parent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSParent.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSParent` `protocol` for an `UFSItem` that can be a parent of another `UFSItem`. 12 | public protocol UFSParent: UFSItem { 13 | /// Return the subitems for the instance of the conforming type. 14 | func subitems() throws -> [UFSSubitem] 15 | /// Return if the instance of the conforming type is empty. 16 | func isEmpty() throws -> Bool 17 | /// Return if the instance of the conforming type contains the specified subitem. 18 | func contains(_ subitem: UFSSubitem) throws -> Bool 19 | } 20 | 21 | extension UFSParent { 22 | /// Returns the subitems of the parent 23 | /// 24 | /// - throws: An `Error`. 25 | /// 26 | /// - returns: All subitems contained in the parent. 27 | public func subitems() throws -> [UFSSubitem] { 28 | var items: [UFSSubitem] = [] 29 | 30 | guard let lastPathComponents = FileManager.default.subpaths(atPath: path.rawValue) else { 31 | return items 32 | } 33 | 34 | for lastPathComponent in lastPathComponents { 35 | let itemPath = path.appendingComponent(lastPathComponent) 36 | 37 | if let item = itemPath.item as? UFSSubitem { 38 | items.append(item) 39 | } 40 | } 41 | 42 | return items 43 | } 44 | 45 | /// Returns wether the parent has 0 subitems. 46 | /// 47 | /// - throws: An `Error`. 48 | /// 49 | /// - returns: A boolean to indicate if the parent is empty, 50 | public func isEmpty() throws -> Bool { 51 | return try subitems().isEmpty 52 | } 53 | 54 | /// Returns wether the parent contains the specified subitem. 55 | /// 56 | /// - parameter subitem: The submitem to check against. 57 | /// 58 | /// - throws: An `Error`. 59 | /// 60 | /// - returns: A boolean to indicate if the parent contains the specified subitem. 61 | public func contains(_ subitem: UFSSubitem) throws -> Bool { 62 | return try subitems().contains(where: { $0.path == subitem.path }) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Path.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSPath.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/09/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// UFSPath represents a file system location on disk. 12 | public struct UFSPath: Equatable, RawRepresentable { 13 | 14 | /// String representation of the path 15 | public let rawValue: String 16 | /// URL representation of the path 17 | public let url: URL 18 | 19 | /// UFSPath Separator 20 | public static let separator: String = "/" 21 | 22 | /// Root UFSPath 23 | public static var root: UFSPath { 24 | return UFSPath(separator) 25 | } 26 | 27 | /// Creates a `UFSPath` instance with the specified raw value. 28 | /// 29 | /// - parameter rawValue: The raw string value for the path. 30 | /// 31 | /// - returns: A new path instance. 32 | public init?(rawValue: String) { 33 | self.rawValue = rawValue 34 | self.url = URL(fileURLWithPath: rawValue) 35 | } 36 | 37 | /// Creates a `UFSPath` instance with the specified raw value. 38 | /// 39 | /// - parameter rawValue: The raw string value for the path. 40 | /// 41 | /// - returns: A new path instance. 42 | public init(_ rawValue: String) { 43 | self.rawValue = rawValue 44 | self.url = URL(fileURLWithPath: rawValue) 45 | } 46 | 47 | /// Creates a `UFSPath` instance with the specified components. 48 | /// 49 | /// - parameter components: The components for the path. 50 | /// 51 | /// - returns: A new path instance. 52 | public init(components: [String]) { 53 | let fileURL = NSURL.fileURL(withPathComponents: components)! as URL 54 | self.init(fileURL) 55 | } 56 | 57 | /// Creates a `UFSPath` instance with the specified components. 58 | /// 59 | /// - parameter url: The url for the path. 60 | /// 61 | /// - returns: A new path instance. 62 | public init(_ url: URL) { 63 | self.rawValue = url.path 64 | self.url = url 65 | } 66 | 67 | /// Returns the path extension. 68 | public var pathExtension: String { 69 | return url.pathExtension 70 | } 71 | 72 | /// Returns the path components. 73 | public var components: [String] { 74 | return url.pathComponents 75 | } 76 | 77 | /// Returns the last path component. 78 | public var lastComponent: String { 79 | return url.lastPathComponent 80 | } 81 | 82 | /// Returns an array of localized path components or nil if the path does not exist. 83 | public var componentsToDisplay: [String]? { 84 | return FileManager.default.componentsToDisplay(forPath: rawValue) 85 | } 86 | 87 | /// Returns wether the path exists. 88 | public var exists: Bool { 89 | return FileManager.default.fileExists(atPath: rawValue) 90 | } 91 | 92 | /// Returns wether the path is a directory. 93 | public var isDirectory: Bool { 94 | var p: ObjCBool = false 95 | let e = FileManager.default.fileExists(atPath: rawValue, isDirectory: &p) 96 | return e ? p.boolValue : e 97 | } 98 | 99 | /// Creates and returns a `UFSDirectory` at the specified path 100 | /// 101 | /// - parameter withIntermediateDirectories: Passing `true` for withIntermediateDirectories will create any necessary intermediate directories. 102 | /// - parameter attributes: The file attributes for the new directory. You can set the owner and group numbers, file permissions, and modification date. If you specify nil for this parameter, the directory is created according to the umask(2) macOS Developer Tools Manual Page of the process. 103 | /// 104 | /// - throws: An `Error`. 105 | /// 106 | /// - returns: A `UFSDirectory` or throws an `Error`. 107 | @discardableResult 108 | public func create(withIntermediateDirectories: Bool = false, attributes: [FileAttributeKey: Any]? = nil) throws -> UFSDirectory { 109 | try FileManager.default.createDirectory(at: url, withIntermediateDirectories: withIntermediateDirectories, attributes: attributes) 110 | return UFSDirectory(self) 111 | } 112 | 113 | /// Returns UFSPath with any symlinks resolved. 114 | public var resolved: UFSPath { 115 | return UFSPath(url.resolvingSymlinksInPath()) 116 | } 117 | 118 | /// Return a standardized UFSPath 119 | public var standardized: UFSPath { 120 | return UFSPath(url.standardizedFileURL) 121 | } 122 | 123 | /// Returns a UFSPath constructed by appending the given path component to self. 124 | /// 125 | /// - note: This function performs a file system operation to determine if the path component is a directory. If so, it will append a trailing `/`. 126 | /// - parameter component: The path component to add. 127 | public func appendingComponent(_ component: String) -> UFSPath { 128 | let url = self.url.appendingPathComponent(component) 129 | return UFSPath(url) 130 | } 131 | 132 | /// Returns a UFSPath constructed by removing the last path component of self. 133 | public func deletingLastComponent() -> UFSPath { 134 | let url = self.url.deletingLastPathComponent() 135 | return UFSPath(url) 136 | } 137 | 138 | /// Returns a UFSPath constructed by replacing the last path component of self. 139 | /// 140 | /// - parameter component: The path component to used to replace the current last path component. 141 | public func replacingLastComponent(with component: String) -> UFSPath { 142 | var pathComponents = components 143 | pathComponents.removeLast() 144 | pathComponents.append(component) 145 | let fileURL = NSURL.fileURL(withPathComponents: pathComponents)! as URL 146 | return UFSPath(fileURL) 147 | } 148 | } 149 | 150 | extension UFSPath: CustomStringConvertible { 151 | /// A textual representation of this instance, returning the `rawValue`. 152 | public var description: String { 153 | return rawValue 154 | } 155 | } 156 | 157 | extension UFSPath: CustomDebugStringConvertible { 158 | /// A textual representation of this instance, returning the `rawValue`. 159 | public var debugDescription: String { 160 | return rawValue 161 | } 162 | } 163 | 164 | extension UFSPath: ExpressibleByStringLiteral { 165 | /// Creates an instance initialized to the given string value. 166 | public init(stringLiteral value: StringLiteralType) { 167 | self.rawValue = value 168 | self.url = URL(fileURLWithPath: value) 169 | } 170 | 171 | /// Creates an instance initialized to the given value. 172 | public init(extendedGraphemeClusterLiteral value: StringLiteralType) { 173 | self.rawValue = value 174 | self.url = URL(fileURLWithPath: value) 175 | } 176 | 177 | /// Creates an instance initialized to the given value. 178 | public init(unicodeScalarLiteral value: StringLiteralType) { 179 | self.rawValue = value 180 | self.url = URL(fileURLWithPath: value) 181 | } 182 | } 183 | 184 | public enum UFSResouceType { 185 | case regularFile 186 | case aliasFile 187 | case symbolickLink 188 | case directory 189 | case volume 190 | 191 | public var resourceKey: URLResourceKey { 192 | switch self { 193 | case .regularFile: 194 | return .isRegularFileKey 195 | case .aliasFile: 196 | return .isAliasFileKey 197 | case .symbolickLink: 198 | return .isSymbolicLinkKey 199 | case .directory: 200 | return .isDirectoryKey 201 | case .volume: 202 | return .isVolumeKey 203 | } 204 | } 205 | } 206 | 207 | public extension URLResourceValues { 208 | func `is`(a type: UFSResouceType) -> Bool? { 209 | switch type { 210 | case .regularFile: 211 | return self.isRegularFile 212 | case .aliasFile: 213 | return self.isAliasFile 214 | case .symbolickLink: 215 | return self.isSymbolicLink 216 | case .directory: 217 | return self.isDirectory 218 | case .volume: 219 | return self.isVolume 220 | } 221 | } 222 | } 223 | 224 | extension UFSPath { 225 | 226 | public func `is`(a type: UFSResouceType) -> Bool { 227 | let resourceValues = try? url.resourceValues(forKeys: [type.resourceKey]) 228 | 229 | if let result = resourceValues?.is(a: type) { 230 | return result 231 | } 232 | return false 233 | } 234 | 235 | /// Returns the item located at self or nil if one does not exist. 236 | public var item: UFSItem? { 237 | if let volume = volumeItem { 238 | return volume 239 | } 240 | if let directory = directoryItem { 241 | return directory 242 | } 243 | if let symbolicLink = symbolickLinkItem { 244 | return symbolicLink 245 | } 246 | if let aliasFile = aliasFileItem { 247 | return aliasFile 248 | } 249 | if let regularFile = regularFileItem { 250 | return regularFile 251 | } 252 | return nil 253 | } 254 | 255 | public var isRegularFilePath: Bool { 256 | return self.is(a: .regularFile) 257 | } 258 | 259 | /// Returns the item located at self or nil if one does not exist. 260 | public var regularFileItem: UFSRegularFile? { 261 | if self.isRegularFilePath { 262 | return UFSRegularFile(self) 263 | } 264 | return nil 265 | } 266 | 267 | public var isSymbolickLinkPath: Bool { 268 | return self.is(a: .symbolickLink) 269 | } 270 | 271 | /// Returns the item located at self or nil if one does not exist. 272 | public var symbolickLinkItem: UFSSymbolicLink? { 273 | if self.isSymbolickLinkPath { 274 | return UFSSymbolicLink(self) 275 | } 276 | return nil 277 | } 278 | 279 | public var isAliasFilePath: Bool { 280 | return self.is(a: .aliasFile) 281 | } 282 | 283 | /// Returns the item located at self or nil if one does not exist. 284 | public var aliasFileItem: UFSAliasFile? { 285 | if self.isAliasFilePath { 286 | return UFSAliasFile(self) 287 | } 288 | return nil 289 | } 290 | 291 | public var isDirectoryPath: Bool { 292 | return self.is(a: .directory) 293 | } 294 | 295 | /// Returns the item located at self or nil if one does not exist. 296 | public var directoryItem: UFSDirectory? { 297 | if self.isDirectoryPath { 298 | return UFSDirectory(self) 299 | } 300 | return nil 301 | } 302 | 303 | public var isVolumePath: Bool { 304 | return self.is(a: .volume) 305 | } 306 | 307 | /// Returns the item located at self or nil if one does not exist. 308 | public var volumeItem: UFSVolume? { 309 | if self.isVolumePath { 310 | return UFSVolume(self) 311 | } 312 | return nil 313 | } 314 | } 315 | 316 | extension UFSPath: Hashable { 317 | /// Return the hash value of the raw value. 318 | public var hashValue: Int { 319 | return rawValue.hashValue 320 | } 321 | } 322 | 323 | /// Returns if the specified paths are equal according to there standardized paths. 324 | public func ==(lhs: UFSPath, rhs: UFSPath) -> Bool { 325 | return lhs.url.standardizedFileURL == rhs.url.standardizedFileURL 326 | } 327 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/PathRepresentable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSPathRepresentable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/09/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSPathRepresentable` can be adopted by anything that can be represented by a `UFSPath`. 12 | public protocol UFSPathRepresentable { 13 | /// The path that is being represented by the instance of the conforming type. 14 | var path: UFSPath { get } 15 | 16 | /// Instantiates an instance of the conforming type from a path representation, can fail if the path is an invalid representation by the conforming type. 17 | init?(path: UFSPath) 18 | } 19 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/RegularFile.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSRegularFile.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSRegularFile` is a `struct` that is used to represent a regular file i.e. not a symlink or alias. 12 | public struct UFSRegularFile: UFSFile, UFSAliasable, UFSFileHandleConvertible, UFSFileWrapperConvertible { 13 | /// The path of the regular file. 14 | public var path: UFSPath 15 | 16 | /// Creates a `UFSRegularFile` instance with the specified path. 17 | /// 18 | /// - parameter path: The path for the regular file. 19 | /// 20 | /// - returns: A new `UFSRegularFile` instance or nil if the `UFSRegularFile` does not exist at the specified path. 21 | public init?(path: UFSPath) { 22 | do { 23 | let resourceValues = try path.url.resourceValues(forKeys: [.isRegularFileKey]) 24 | 25 | if let isRegularFile = resourceValues.isRegularFile, isRegularFile { 26 | self.init(path: path) 27 | } else { 28 | return nil 29 | } 30 | 31 | } catch _ { 32 | return nil 33 | } 34 | } 35 | 36 | /// Creates a `UFSRegularFile` instance with the specified path. 37 | /// 38 | /// - parameter path: The path for the regular file. 39 | /// 40 | /// - returns: A new `UFSRegularFile` instance. 41 | public init(_ path: UFSPath) { 42 | self.path = path 43 | } 44 | 45 | /// Returns the contents of the file in bytes. 46 | /// 47 | /// - throws: An `Error`. 48 | /// 49 | /// - returns: The contents of the file in bytes. 50 | public func size() throws -> Int { 51 | let values = try path.url.resourceValues(forKeys: [.fileSizeKey]) 52 | return values.fileSize! 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Removeable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSRemoveable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSRenameable` `protocol` for an `UFSItem` that can be removed. 12 | public protocol UFSRemoveable: UFSItem { 13 | /// Removes the instance of the conforming type. 14 | func remove() throws 15 | } 16 | 17 | extension UFSRemoveable { 18 | /// Remove the `UFSItem`. 19 | /// 20 | /// - note: This function removes the item instantly. 21 | /// 22 | /// - throws: An `Error`. 23 | public func remove() throws { 24 | try FileManager.default.removeItem(at: path.url) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Renameable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSRenameable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSRenameable` `protocol` for an `UFSItem` that can be renamed. 12 | public protocol UFSRenameable: UFSItem { 13 | /// Renames the instance of the conforming type to the specified name. 14 | mutating func rename(to name: String) throws 15 | } 16 | 17 | extension UFSRenameable { 18 | /// Rename the `UFSItem` to the specified name. 19 | /// 20 | /// - parameter name: The new name of the item. 21 | /// 22 | /// - throws: An `Error`. 23 | mutating public func rename(to name: String) throws { 24 | try FileManager.default.moveItem(at: path.url, to: path.replacingLastComponent(with: name).url) 25 | self.path = path 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Subitem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSSubitem.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSSubitem` `protocol` for an `UFSItem` that can be a subitem of another `UFSItem`. 12 | public protocol UFSSubitem: UFSItem { 13 | /// Returns the root volume for the instance of the conforming type. 14 | func rootVolume() throws -> UFSVolume 15 | /// Returns the parent directory for the instance of the conforming type. 16 | func parentDirectory() throws -> UFSDirectory? 17 | } 18 | 19 | extension UFSSubitem { 20 | /// Returns the root `UFSVolume` for an `UFSItem`. 21 | /// 22 | /// - throws: An `Error`. 23 | /// 24 | /// - returns: A `UFSVolume` 25 | public func rootVolume() throws -> UFSVolume { 26 | let values = try path.url.resourceValues(forKeys: [.volumeURLKey]) 27 | return UFSVolume(UFSPath(values.volume!)) 28 | } 29 | 30 | /// Returns the parent `UFSDirectory` for an `UFSItem` or nil if the directory is the root directory of a volume. 31 | /// 32 | /// - throws: An `Error`. 33 | /// 34 | /// - returns: A `UFSDirectory` or nil 35 | public func parentDirectory() throws -> UFSDirectory? { 36 | do { 37 | let values = try path.url.resourceValues(forKeys: [.parentDirectoryURLKey]) 38 | 39 | guard let parentDirectoryURL = values.parentDirectory else { 40 | return nil 41 | } 42 | 43 | return UFSDirectory(path: UFSPath(parentDirectoryURL)) 44 | } catch { 45 | return nil 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/SymbolicLink.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSSymbolicLink.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSSymbolicLink` is a `struct` that is used to represent a symbolic link. 12 | public struct UFSSymbolicLink: UFSFile, UFSFileWrapperConvertible { 13 | /// The path of the symbolic link. 14 | public var path: UFSPath 15 | 16 | /// Creates a `UFSSymbolicLink` instance with the specified path. 17 | /// 18 | /// - parameter path: The path for the symbolic link. 19 | /// 20 | /// - returns: A new `UFSSymbolicLink` instance or nil if the `UFSSymbolicLink` does not exist at the specified path. 21 | public init?(path: UFSPath) { 22 | do { 23 | let resourceValues = try path.url.resourceValues(forKeys: [.isSymbolicLinkKey]) 24 | 25 | if let isSymbolicLink = resourceValues.isSymbolicLink, isSymbolicLink { 26 | self.init(path: path) 27 | } else { 28 | return nil 29 | } 30 | 31 | } catch _ { 32 | return nil 33 | } 34 | } 35 | 36 | /// Creates a `UFSSymbolicLink` instance with the specified path. 37 | /// 38 | /// - parameter path: The path for the symbolic link. 39 | /// 40 | /// - returns: A new `UFSSymbolicLink` instance. 41 | public init(_ path: UFSPath) { 42 | self.path = path 43 | } 44 | 45 | /// Returns a `UFSSymbolicLinkable` destination if `path` is a valid symbolic link, otherise throws an `Error`. 46 | /// 47 | /// - throws: An `URLError`. 48 | /// 49 | /// - returns: A `UFSSymbolicLinkable`. 50 | public func destination() throws -> UFSSymbolicLinkable { 51 | let destinationURL = try FileManager.default.destinationOfSymbolicLink(atPath: path.rawValue) 52 | if let destination = UFSPath(destinationURL).item as? UFSSymbolicLinkable { 53 | return destination 54 | } else { 55 | throw URLError(.fileDoesNotExist) 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/SymbolicLinkable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSSymbolicLinkable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSSymbolicLinkable` `protocol` for an `UFSItem` that can be symbolic linked to a `UFSPath`. 12 | public protocol UFSSymbolicLinkable: UFSItem { 13 | /// Symbolic links the instance of the conforming type to the specified path, returning the symbolic link. 14 | func symbolicLink(to path: UFSPath) throws -> UFSSymbolicLink 15 | } 16 | 17 | extension UFSSymbolicLinkable { 18 | /// Returns a `UFSSymbolicLink` created at the specified `UFSPath`. 19 | /// 20 | /// - parameter path: The path to create thw symbolic link at. 21 | /// 22 | /// - throws: An `Error`. 23 | /// 24 | /// - returns: The created `UFSSymbolicLink`. 25 | public func symbolicLink(to path: UFSPath) throws -> UFSSymbolicLink { 26 | try FileManager.default.createSymbolicLink(at: self.path.url, withDestinationURL: path.url) 27 | return UFSSymbolicLink(path) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Trashable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSTrashable.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 23/02/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSTrashable` `protocol` for an `UFSItem` that can be trashed on macOS. 12 | @available(macOS 10.10, *) 13 | public protocol UFSTrashable: UFSItem { 14 | #if os(macOS) 15 | /// Trashes the instance of the conforming type. 16 | mutating func trash() throws 17 | #endif 18 | } 19 | 20 | @available(macOS 10.10, *) 21 | extension UFSTrashable { 22 | #if os(macOS) 23 | /// Trash the `UFSItem`. 24 | mutating public func trash() throws { 25 | var resultingURL: NSURL? 26 | try FileManager.default.trashItem(at: path.url, resultingItemURL: &resultingURL) 27 | self.path = UFSPath(resultingURL! as URL) 28 | } 29 | #endif 30 | } 31 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/UFS.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UNIXFileSystem.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 2016-06-24. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// UNIX File System Framework 12 | public struct UNIXFileSystem { 13 | 14 | } 15 | 16 | // MARK: - Typealias 17 | public typealias UFS = UNIXFileSystem 18 | public typealias FileSystem = UNIXFileSystem 19 | 20 | // MARK: - Values 21 | public extension UNIXFileSystem { 22 | 23 | static var root: UFSDirectory { 24 | return UFSDirectory.root 25 | } 26 | 27 | /// Returns a Temporary `UFSDirectory`. 28 | @available(iOS 10.0, tvOS 10.0, watchOS 3.0, macOS 10.12, *) 29 | static var temporary: UFSDirectory { 30 | return UFSDirectory.temporary 31 | } 32 | 33 | /// Returns the Document `UFSDirectory` in the current users home directory. 34 | static var document: UFSDirectory { 35 | return UFSDirectory.document 36 | } 37 | 38 | /// Returns the Library `UFSDirectory` in the current users home directory. 39 | static var library: UFSDirectory { 40 | return UFSDirectory.library 41 | } 42 | 43 | /// Returns the Caches `UFSDirectory` in the current users home directory. 44 | static var caches: UFSDirectory { 45 | return UFSDirectory.caches 46 | } 47 | 48 | /// Returns the Application(s) `UFSDirectory` in the current users home directory. 49 | static var application: UFSDirectory { 50 | return UFSDirectory.application 51 | } 52 | 53 | /// Returns the Application Support UFSDirectory in the current users home directory. 54 | static var applicationSupport: UFSDirectory { 55 | return UFSDirectory.applicationSupport 56 | } 57 | 58 | /// Returns the Desktop `UFSDirectory` in the current users home directory. 59 | static var desktop: UFSDirectory { 60 | return UFSDirectory.desktop 61 | } 62 | 63 | /// Returns the Downloads `UFSDirectory` in the current users home directory. 64 | static var downloads: UFSDirectory { 65 | return UFSDirectory.downloads 66 | } 67 | 68 | /// Returns the Movies `UFSDirectory` in the current users home directory. 69 | static var movies: UFSDirectory { 70 | return UFSDirectory.movies 71 | } 72 | 73 | /// Returns the Music `UFSDirectory` in the current users home directory. 74 | static var music: UFSDirectory { 75 | return UFSDirectory.music 76 | } 77 | 78 | /// Returns the Pictures `UFSDirectory` in the current users home directory. 79 | static var pictures: UFSDirectory { 80 | return UFSDirectory.pictures 81 | } 82 | 83 | /// Returns all directories where applications can be stored in the current users home directory. 84 | static var applications: [UFSDirectory] { 85 | return UFSDirectory.applications 86 | } 87 | 88 | /// Returns all libaries where applications can be stored in the current users home directory. 89 | static var libraries: [UFSDirectory] { 90 | return UFSDirectory.libraries 91 | } 92 | } 93 | 94 | // MARK: - Creation 95 | public extension UNIXFileSystem { 96 | 97 | /// Creates and returns a `UFSDirectory` at the specified path 98 | /// 99 | /// - parameter folder: A folder name 100 | /// - parameter directory: Parent directory 101 | /// - parameter withIntermediateDirectories: Passing `true` for withIntermediateDirectories will create any necessary intermediate directories. 102 | /// - parameter attributes: The file attributes for the new directory. You can set the owner and group numbers, file permissions, and modification date. If you specify nil for this parameter, the directory is created according to the umask(2) macOS Developer Tools Manual Page of the process. 103 | /// 104 | /// - throws: An `Error`. 105 | /// 106 | /// - returns: A `UFSDirectory` or throws an `Error`. 107 | @discardableResult 108 | static func create(folder: String, in directory: UFSDirectory, withIntermediateDirectories: Bool = false, attributes: [FileAttributeKey: Any]? = nil) throws -> UFSDirectory { 109 | return try UNIXFileSystem.create(folder: folder, at: directory.path, withIntermediateDirectories: withIntermediateDirectories, attributes: attributes) 110 | } 111 | 112 | /// Creates and returns a `UFSDirectory` at the specified path 113 | /// 114 | /// - parameter folder: A folder name 115 | /// - parameter path: The parent path 116 | /// - parameter withIntermediateDirectories: Passing `true` for withIntermediateDirectories will create any necessary intermediate directories. 117 | /// - parameter attributes: The file attributes for the new directory. You can set the owner and group numbers, file permissions, and modification date. If you specify nil for this parameter, the directory is created according to the umask(2) macOS Developer Tools Manual Page of the process. 118 | /// 119 | /// - throws: An `Error`. 120 | /// 121 | /// - returns: A `UFSDirectory` or throws an `Error`. 122 | @discardableResult 123 | static func create(folder: String, at path: UFSPath, withIntermediateDirectories: Bool = false, attributes: [FileAttributeKey: Any]? = nil) throws -> UFSDirectory { 124 | if path.exists && path.isDirectory { 125 | return UFSDirectory(path) 126 | } 127 | return try path.create(withIntermediateDirectories: withIntermediateDirectories, attributes: attributes) 128 | } 129 | } 130 | 131 | // MARK: - Rename 132 | public extension UNIXFileSystem { 133 | 134 | static func rename(item: inout T, to name: String) throws { 135 | try item.rename(to: name) 136 | } 137 | } 138 | 139 | // MARK: - Remove 140 | public extension UNIXFileSystem { 141 | 142 | static func remove(item: T) throws { 143 | try item.remove() 144 | } 145 | } 146 | 147 | // MARK: - Move 148 | public extension UNIXFileSystem { 149 | 150 | static func move(item: inout T, to path: UFSPath) throws { 151 | try item.move(to: path) 152 | } 153 | 154 | static func move(item: inout T, into parent: UFSParent) throws { 155 | try item.move(into: parent) 156 | } 157 | } 158 | 159 | // MARK: - Copy 160 | public extension UNIXFileSystem { 161 | 162 | @discardableResult 163 | static func copy(item: T, to path: UFSPath) throws -> T { 164 | return try item.copy(to: path) 165 | } 166 | 167 | @discardableResult 168 | static func copy(item: T, into parent: UFSParent) throws -> T { 169 | return try item.copy(into: parent) 170 | } 171 | } 172 | 173 | // MARK: - Link 174 | public extension UNIXFileSystem { 175 | /// Link to the specified `UFSPath`. 176 | /// 177 | /// - parameter file: The file. 178 | /// - parameter path: The path to link to. 179 | /// 180 | /// - throws: An `Error`. 181 | /// 182 | /// - returns: the created `UFSLinkable`. 183 | static func link(item: T, to path: UFSPath) throws -> UFSLinkable { 184 | return try item.link(to: path) 185 | } 186 | 187 | /// Returns a `UFSSymbolicLink` created at the specified `UFSPath`. 188 | /// 189 | /// - parameter item: The item. 190 | /// - parameter path: The path to create thw symbolic link at. 191 | /// 192 | /// - throws: An `Error`. 193 | /// 194 | /// - returns: The created `UFSSymbolicLink`. 195 | static func symbolicLink(item: T, to path: UFSPath) throws -> UFSSymbolicLink { 196 | return try item.symbolicLink(to: path) 197 | } 198 | } 199 | 200 | // MARK: - Trash 201 | public extension UNIXFileSystem { 202 | #if os(macOS) 203 | /// Trash the `UFSDirectory`. 204 | @available(macOS 10.10, *) 205 | public static func trash(item: inout T) throws { 206 | try item.trash() 207 | } 208 | #endif 209 | } 210 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/UNIXFileSystem.h: -------------------------------------------------------------------------------- 1 | // 2 | // UNIXFileSystem.h 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 29/02/2016. 6 | // 7 | // 8 | 9 | @import Foundation; 10 | 11 | //! Project version number for UNIXFileSystem. 12 | FOUNDATION_EXPORT double UNIXFileSystemVersionNumber; 13 | 14 | //! Project version string for UNIXFileSystem. 15 | FOUNDATION_EXPORT const unsigned char UNIXFileSystemVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /UNIXFileSystem/Source/Volume.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UFSVolume.swift 3 | // UNIXFileSystem 4 | // 5 | // Created by Meniny on 21/09/2016. 6 | // Copyright © 2016 Meniny. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// `UFSVolume` is a `struct` that is used to represent a volume. 12 | public struct UFSVolume: UFSItem, UFSParent, UFSRenameable, UFSLinkable, UFSSymbolicLinkable { 13 | /// The path of the volume. 14 | public var path: UFSPath 15 | 16 | /// Creates a `UFSVolume` instance with the specified path. 17 | /// 18 | /// - parameter path: The path for the volume. 19 | /// 20 | /// - returns: A new `UFSVolume` instance or nil if the `UFSVolume` does not exist at the specified path. 21 | public init?(path: UFSPath) { 22 | do { 23 | let resourceValues = try path.url.resourceValues(forKeys: [.isVolumeKey]) 24 | 25 | if let isVolume = resourceValues.isVolume, isVolume { 26 | self.init(path: path) 27 | } else { 28 | return nil 29 | } 30 | 31 | } catch _ { 32 | return nil 33 | } 34 | } 35 | 36 | /// Creates a `UFSVolume` instance with the specified path. 37 | /// 38 | /// - parameter path: The path for the volume. 39 | /// 40 | /// - returns: A new `UFSVolume` instance. 41 | public init(_ path: UFSPath) { 42 | self.path = path 43 | } 44 | 45 | /// Returns mounted volumes. 46 | public static var mounted: [UFSVolume] { 47 | guard let volumeURLs = FileManager.default.mountedVolumeURLs(includingResourceValuesForKeys: [], options: []), volumeURLs.isEmpty == false else { 48 | return [] 49 | } 50 | 51 | var volumes: [UFSVolume] = [] 52 | 53 | for volumeURL in volumeURLs { 54 | let volume = UFSVolume(UFSPath(volumeURL)) 55 | volumes.append(volume) 56 | } 57 | 58 | return volumes 59 | } 60 | 61 | #if os(macOS) 62 | /// Unmounts the volume. 63 | /// 64 | /// - parameter options: An array of `FileManager.UnmountOptions` used to unmount the volume. 65 | /// - parameter completionHandler: The completion handler will be executed when the operation is complete, error will be nil the volume was unmounted. 66 | @available(macOS 10.11, *) 67 | public func unmount(withOptions options: FileManager.UnmountOptions = [], completionHandler: @escaping (Error?) -> Void) { 68 | FileManager.default.unmountVolume(at: path.url, options: options, completionHandler: completionHandler) 69 | } 70 | #endif 71 | 72 | /// Returns if total capacity of the volume in bytes. 73 | public func totalCapacity() throws -> Int { 74 | let values = try path.url.resourceValues(forKeys: [.volumeTotalCapacityKey]) 75 | return values.volumeTotalCapacity! 76 | } 77 | 78 | /// Returns if available capacity of the volume in bytes. 79 | public func availableCapacity() throws -> Int { 80 | let values = try path.url.resourceValues(forKeys: [.volumeAvailableCapacityKey]) 81 | return values.volumeAvailableCapacity! 82 | } 83 | 84 | /// Returns if used capacity of the volume in bytes. 85 | public func usedCapacity() throws -> Int { 86 | let total = try totalCapacity() 87 | let available = try availableCapacity() 88 | return total - available 89 | } 90 | 91 | /// Returns if the volume is ejectable. 92 | public func isEjectable() throws -> Bool { 93 | let values = try path.url.resourceValues(forKeys: [.volumeIsEjectableKey]) 94 | return values.volumeIsEjectable! 95 | } 96 | 97 | /// Returns if the volume is removeable. 98 | public func isRemovable() throws -> Bool { 99 | let values = try path.url.resourceValues(forKeys: [.volumeIsRemovableKey]) 100 | return values.volumeIsRemovable! 101 | } 102 | 103 | /// Returns if the volume is internal. 104 | public func isInternal() throws -> Bool { 105 | let values = try path.url.resourceValues(forKeys: [.volumeIsInternalKey]) 106 | return values.volumeIsInternal! 107 | } 108 | 109 | /// Returns if the volume is local. 110 | public func isLocal() throws -> Bool { 111 | let values = try path.url.resourceValues(forKeys: [.volumeIsLocalKey]) 112 | return values.volumeIsLocal! 113 | } 114 | 115 | /// Returns if the volume is read only. 116 | public func isReadOnly() throws -> Bool { 117 | let values = try path.url.resourceValues(forKeys: [.volumeIsReadOnlyKey]) 118 | return values.volumeIsReadOnly! 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/project.xcworkspace/xcuserdata/elias.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meniny/UNIXFileSystem/dcfa49365671160596e43b43acad28f04db0deef/UNIXFileSystem/UNIXFileSystem.xcodeproj/project.xcworkspace/xcuserdata/elias.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/macOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/watchOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/xcuserdata/Meniny.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iOS.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | macOS.xcscheme 13 | 14 | orderHint 15 | 1 16 | 17 | tvOS.xcscheme 18 | 19 | orderHint 20 | 3 21 | 22 | watchOS.xcscheme 23 | 24 | orderHint 25 | 2 26 | 27 | 28 | SuppressBuildableAutocreation 29 | 30 | 5CCED8701EFEACC4007A648C 31 | 32 | primary 33 | 34 | 35 | 5CCED8801EFEACE7007A648C 36 | 37 | primary 38 | 39 | 40 | 5CCED88D1EFEACF3007A648C 41 | 42 | primary 43 | 44 | 45 | 5CCED89A1EFEAD05007A648C 46 | 47 | primary 48 | 49 | 50 | 5CCED8A71EFEAD16007A648C 51 | 52 | primary 53 | 54 | 55 | 5CCED8B41EFEAD1E007A648C 56 | 57 | primary 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /UNIXFileSystem/UNIXFileSystem.xcodeproj/xcuserdata/elias.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iOS.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | macOS.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | tvOS.xcscheme 18 | 19 | orderHint 20 | 3 21 | 22 | watchOS.xcscheme 23 | 24 | orderHint 25 | 2 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /UNIXFileSystem/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /UNIXFileSystem/iOS/iOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // iOS.h 3 | // iOS 4 | // 5 | // Created by Meniny on 2017-06-24. 6 | // Copyright © 2017年 Meniny. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for iOS. 12 | FOUNDATION_EXPORT double iOSVersionNumber; 13 | 14 | //! Project version string for iOS. 15 | FOUNDATION_EXPORT const unsigned char iOSVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /UNIXFileSystem/macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2017年 Meniny. All rights reserved. 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /UNIXFileSystem/macOS/macOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // macOS.h 3 | // macOS 4 | // 5 | // Created by Meniny on 2017-06-24. 6 | // Copyright © 2017年 Meniny. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for macOS. 12 | FOUNDATION_EXPORT double macOSVersionNumber; 13 | 14 | //! Project version string for macOS. 15 | FOUNDATION_EXPORT const unsigned char macOSVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /UNIXFileSystem/tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /UNIXFileSystem/tvOS/tvOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // tvOS.h 3 | // tvOS 4 | // 5 | // Created by Meniny on 2017-06-24. 6 | // Copyright © 2017年 Meniny. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for tvOS. 12 | FOUNDATION_EXPORT double tvOSVersionNumber; 13 | 14 | //! Project version string for tvOS. 15 | FOUNDATION_EXPORT const unsigned char tvOSVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /UNIXFileSystem/watchOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /UNIXFileSystem/watchOS/watchOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // watchOS.h 3 | // watchOS 4 | // 5 | // Created by Meniny on 2017-06-24. 6 | // Copyright © 2017年 Meniny. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for watchOS. 12 | FOUNDATION_EXPORT double watchOSVersionNumber; 13 | 14 | //! Project version string for watchOS. 15 | FOUNDATION_EXPORT const unsigned char watchOSVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | --------------------------------------------------------------------------------