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

Support Linux #1

Open
chrispomeroyhale opened this issue Jun 30, 2021 · 1 comment
Open

Support Linux #1

chrispomeroyhale opened this issue Jun 30, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@chrispomeroyhale
Copy link
Owner

chrispomeroyhale commented Jun 30, 2021

In the past support for Linux has been unavailable because this library uses Scanner from the Foundation framework to parse CSV text. Unfortunately the implementation of Scanner has been incomplete in swift-corelibs-foundation.

This may have changed recently. Foundation support is listed here and it appears the Scanner APIs have also been updated to better reflect the changes on Apple platforms for better API compatibility which had also been a blocker.

@chrispomeroyhale
Copy link
Owner Author

There continue to be two type issues. Apple's version of Scanner (formerly NSScanner) continues to use NSString while the corelibs uses String:

Sources/ImportParser.swift:66:70: error: cannot convert value of type 'UnsafeMutablePointer<NSString?>' to expected argument type 'UnsafeMutablePointer<String?>'
            if !scanner.scanUpToCharacters(from: characterSet, into: &fieldPartition), scanner.isAtEnd {
                                                                     ^
Sources/ImportParser.swift:66:70: note: arguments to generic parameter 'Pointee' ('NSString?' and 'String?') are expected to be equal
            if !scanner.scanUpToCharacters(from: characterSet, into: &fieldPartition), scanner.isAtEnd {
                                                                     ^

And

Sources/ImportParser.swift:79:68: error: cannot convert value of type 'UnsafeMutablePointer<NSString?>' to expected argument type 'UnsafeMutablePointer<String?>'
            guard scanner.scanCharacters(from: characterSet, into: &characters), let specials = characters as String? else {
                                                                   ^
Sources/ImportParser.swift:79:68: note: arguments to generic parameter 'Pointee' ('NSString?' and 'String?') are expected to be equal
            guard scanner.scanCharacters(from: characterSet, into: &characters), let specials = characters as String? else {
                                                                   ^

This error is protected by an if #available(iOS 13, macOS 10.15, *) so this error is unexpected:

Sources/InputHandler.swift:143:37: error: 'seek(toOffset:)' is unavailable
                try self.fileHandle.seek(toOffset: startOffset)
                                    ^~~~
Foundation.FileHandle:21:17: note: 'seek(toOffset:)' was introduced in Swift 5.0
    public func seek(toOffset offset: UInt64) throws
                ^

@chrispomeroyhale chrispomeroyhale added the enhancement New feature or request label Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant