Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileManagerExtension.swift mainBundlePath() return nil #27

Closed
jiongge opened this issue Apr 14, 2017 · 1 comment
Closed

FileManagerExtension.swift mainBundlePath() return nil #27

jiongge opened this issue Apr 14, 2017 · 1 comment

Comments

@jiongge
Copy link

jiongge commented Apr 14, 2017

// MARK: - Functions

/// Get the path for a PathType.
///
/// - Parameter path: Path type.
/// - Returns: Returns the path type String.
public func pathFor(_ path: PathType) -> String? {
    var pathString: String?
    
    switch path {
    case .mainBundle:
        pathString = self.mainBundlePath()
   ...
    }
    
    return pathString
}

self.mainBundlePath() always return nil

I recommend to switch

/// Get Main Bundle path for a filename.
///
/// - Parameter file: Filename
/// - Returns: Returns the path as a String.
public func mainBundlePath(file: String = "") -> String? {
return file.isEmpty ? Bundle.main.bundlePath : Bundle.main.path(forResource: file.deletingPathExtension, ofType: file.pathExtension)
}

@FabrizioBrancati
Copy link
Owner

Thanks! I've changed it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants