ApolloExtension
EXTENSION
ApolloExtension
1extension ApolloExtension where Base == FileManagerMethods
fileExists(at:)
1public func fileExists(at path: String) -> BoolChecks if a file exists (and is not a folder) at the given path
Parameter path: The path to check
Returns:
trueif there is something at the path and it is a file, not a folder.
Parameters
| Name | Description |
|---|---|
| path | The path to check |
fileExists(at:)
1public func fileExists(at url: URL) -> BoolChecks if a file exists (and is not a folder) at the given URL
Parameter url: The URL to check
Returns:
trueif there is something at the URL and it is a file, not a folder.
Parameters
| Name | Description |
|---|---|
| url | The URL to check |
folderExists(at:)
1public func folderExists(at path: String) -> BoolChecks if a folder exists (and is not a file) at the given path.
Parameter path: The path to check
Returns:
trueif there is something at the path and it is a folder, not a file.
Parameters
| Name | Description |
|---|---|
| path | The path to check |
folderExists(at:)
1public func folderExists(at url: URL) -> BoolChecks if a folder exists (and is not a file) at the given URL.
Parameter url: The URL to check
Returns:
trueif there is something at the URL and it is a folder, not a file.
Parameters
| Name | Description |
|---|---|
| url | The URL to check |
deleteFolder(at:)
1public func deleteFolder(at url: URL) throwsChecks if a folder exists then attempts to delete it if it's there.
Parameter url: The URL to delete the folder for
Parameters
| Name | Description |
|---|---|
| url | The URL to delete the folder for |
deleteFile(at:)
1public func deleteFile(at url: URL) throwsChecks if a file exists then attempts to delete it if it's there.
Parameter url: The URL to delete the file for
Parameters
| Name | Description |
|---|---|
| url | The URL to delete the file for |
createContainingFolderIfNeeded(for:)
1public func createContainingFolderIfNeeded(for fileURL: URL) throwsCreates the containing folder (including all intermediate directories) for the given file URL if necessary.
Parameter fileURL: The URL of the file to create a containing folder for if necessary.
Parameters
| Name | Description |
|---|---|
| fileURL | The URL of the file to create a containing folder for if necessary. |
createFolderIfNeeded(at:)
1public func createFolderIfNeeded(at url: URL) throwsCreates the folder (including all intermediate directories) for the given URL if necessary.
Parameter url: The URL of the folder to create if necessary.
Parameters
| Name | Description |
|---|---|
| url | The URL of the folder to create if necessary. |
shasum(at:)
1public func shasum(at fileURL: URL) throws -> StringCalculates the SHASUM (ie, SHA256 hash) of the given file
Parameter fileURL: The file to calculate the SHASUM for.
Parameters
| Name | Description |
|---|---|
| fileURL | The file to calculate the SHASUM for. |
parentFolderURL()
1public func parentFolderURL() -> URLReturns: the URL to the parent folder of the current URL.
childFolderURL(folderName:)
1public func childFolderURL(folderName: String) -> URLParameter folderName: The name of the child folder to append to the current URL
Returns: The full URL including the appended child folder.
Parameters
| Name | Description |
|---|---|
| folderName | The name of the child folder to append to the current URL |
childFileURL(fileName:)
1public func childFileURL(fileName: String) throws -> URLAdds the filename to the caller to get the full URL of a file
Parameters:
fileName: The name of the child file, with an extension, for example
"API.swift". Note: For hidden files just pass".filename".
Returns: The full URL including the full file.
Parameters
| Name | Description |
|---|---|
| fileName | The name of the child file, with an extension, for example "API.swift". Note: For hidden files just pass ".filename". |