Giter Site home page Giter Site logo

filekit's Issues

warning: 'ExpressibleByStringInterpolation' is deprecated

Hi,
When I build your component with carthage I have these warnings:

../Sources/Carthage/Checkouts/FileKit/Sources/Path.swift:1066:17: warning: 'ExpressibleByStringInterpolation' is deprecated: it will be replaced or redesigned in Swift 4.0.  Instead of conforming to 'ExpressibleByStringInterpolation', consider adding an 'init(_:String)'
../Sources/Carthage/Checkouts/FileKit/Sources/TextFile.swift:231:21: warning: conditional downcast from 'NSString?' to 'String' is a bridging conversion; did you mean to use 'as'?

Debugger support?

I've used FileKit for a while now, but a problem has plagued me often.
I'm never able to po anything FileKit related.

Any ideas why this is the case?

for example :
(lldb) po name
expression produced error: error: /var/folders/cs/51wtzgp51v157z25_b0fjqn80000gn/T/expr10-5d206b..swift:1:85: error: 'Path' is not a member type of 'FileKit'
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Swift.Array<FileKit.Path>>(bitPattern: 0x1037ff9e0)!.pointee)
~~~~~~~ ^

Sorted Path's children

Hi,
how can I obtain the children of a Path sorted by descendant modified date, for example?

NSFileHandle-based implementation and exceptions

I noticed that FileKit is based on NSFileHandle. NSFileHandle has an API that is based on (Objective-C) exceptions. The FileKit codebase currently does not catch those. IMO, this is required to make it possible to safely use FileKit (without arbitrary application terminations).

iOS should have UserDocuments as well

Can you allow Path.UsersDocuments for iOS in addition to OSX?
And can you make Path.pathInUserDomain, Path.pathsInDomains public? This way I can extend Path with more iOS paths such as UsersDocuments

Build Failing on Swift 3.1

PR #44 fixes the build error, but these changes have not been released yet. When will you release these as a minor version update?

Path.children always returns 0 Results

Code Example

print(Path.userDesktop.children().count) // 0
print(Path("my path with children").children().count) // 0

Now, both of the paths that I tested with do have children but the .children() method seems to always return 0.

I was using version 5.0.0 with Swift 4 on a Mac OS app.

How to read and write line by line?

Why is it that there are no file read and write routines to read individual lines from a file, or write individual lines to a file, without having to open and close the file around each line (such as your |>> operator)?

I really love the Swift language, except that I can't read or write a text file in a normal manner. Reading the whole file at once is great... unless your file is several Megabytes, or several Terabytes long. I really just want to read a file, line by line, in a way that won't eat up all of memory.

I'm just frustrated, saw your library, and thought that it might be the solution I was looking for. O.o

BUILD FAILED - Xcode 8.1 - Carthage

A shell task (/usr/bin/xcrun xcodebuild -project /Users/NEO/Workspace/Swift3/hsound/HSound/Carthage/Checkouts/FileKit/FileKit.xcodeproj -scheme FileKit-iOS -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
** BUILD FAILED **

The following build commands failed:
CompileSwift normal arm64
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)

File System Watching Documentation

I read the release notes for v3.0.0, and "File system watching" caught my eye. I need to do file system watching in my application so that I can update a CollectionView as the contents of a directory change.

I don't see where usage of this feature is documented. Can you point me to where it is, or if there isn't any documentation, can you please provide some? I would love to take advantage of this feature.

Thanks!

Cannot convert value of type '[FileAttributeKey : Any]' to expected argument type '[String : Any]?'

Xcode9
after pod install
Swift Compiler Error Group:
/Users/matthewxu/project/LiLiTools/Pods/FileKit/Sources/FileProtection.swift:126:82: Cannot convert value of type '[FileAttributeKey : Any]' to expected argument type '[String : Any]?'
on manager.createFile(atPath: _safeRawValue, contents: nil, attributes: attributes) {
in the following codes

public func createFile(_ fileProtection: FileProtection) throws {
       let manager = FileManager()
       let attributes: [FileAttributeKey : Any] = [.protectionKey: fileProtection] // todo test

       if !manager.createFile(atPath: _safeRawValue, contents: nil, attributes: attributes) { 
           throw FileKitError.createFileFail(path: self)
       }
   }

Any one meet this issue and how to solve it

How to rename?

Although FileKit is a really great library, I have a small problem with it.
Situation: I want to copy a file from one location to another location with a different name. With the copyToPath method I get the file with the original name from path1 to path2. But: How do I rename the file there? Changing the name does not succeed, as name is read-only. So, I'm stuck a bit...
Perhaps you might give me hint for that - thanks a lot in advance!

  • Hardy

v4.0.0 Release Notes

I was just wondering what the release notes for v4.0.0 are. On your releases page there are no release notes. I'd like to know what the changes are so I can upgrade accordingly.

Thanks!

Swift 4.1 Compatibility

I am getting a single error on the latest release of FileKit (5.2.0), the error is:
Value of type 'UIImage' has no member 'pngData'

Clean up API and add Swift 3 support

Future API should be written to be compatible with Swift 3.

Because Swift 2 support is being dropped, this is a breaking change that will result in a major version change for FileKit to 4.0.0.

Also, a lot of documentation is also either ambiguous or just weirdly worded.

Cleaning up the API entails following the Swift API Style Guidelines.

Note: Adding Swift 3 support consists of keeping this up to date with Swift 3 until a final release is made. Then there'll be no breaking changes, allowing for version 4.

  • Swift 3 compatibility #27
  • Cleaned up API

CocoaPods extremely out-of-date (5.2 when it should be 6.0)

I was able to find this issue #73 but I do not understand why it was closed without any resolution. Does no-one maintaining this project have access to update the Podspec in the public CocoaPods repo? I am happy to help in anyway I can to make this happen. Thanks!

Support Linux?

Hi, will FileKit support Linux as well? Currently I'm not able to build 3.0.0 tag due issue with Image+File.swift where is WatchKit imported, which is something that doesn't exist on Linux version of Swift.
Thanks.

testWatch() Fails on First Run

When testing FileKit, testWatch() will sometimes fail on the first attempt. I'm not familiar with GCD, so I don't necessarily know why this occurs.

Static let 'NowEventId' is internal and cannot be referenced from a default argument value

Hi,
I'm getting a compiler error when building my macOS app using FileKit integrated with Cocoapods.

The app is for macOS 10.13. I'm using Xcode 9.0.1, Cocoapods and FileKit 4.0.1 (5.0.0 was not available over Cocoapods)

If I want to compile the I getting this error:

Static let 'NowEventId' is internal and cannot be referenced from a default argument value

public init(paths: [Path],
                sinceWhen: FSEventStreamEventId = FileSystemEvent.NowEventId,
                flags: FileSystemEventStreamCreateFlags = [.UseCFTypes, .FileEvents],
                latency: CFTimeInterval = 0,
                queue: DispatchQueue? = nil,
                callback: @escaping (FileSystemEvent) -> Void
        ) {
        self.lastEventId = sinceWhen
        self.paths       = paths
        self.flags       = flags
        self.latency     = latency
        self.queue       = queue
        self._callback   = callback
    }

Codable doesn't conform to ReadableWritable

I'm not sure if this is an oversight, but there's no default conformance for Codable to ReadableWriteable.

This conformance would allow for File<DataType: ReadableWritable> to work with any Codable and appears to be the intent as listed in the readme.

CocoaPods version not updated

Your podspec/releases show 5.1.0, but cocoapods only has up to 5.0.0. Please run pod trunk push to update cocoapods with your latest podspec. Thanks!

Support Decodable/Encodable (Swift 4)

In the past, I try to make some utility functions to work with NSCoding (branch feature-nscoding), write and read JSON

In swift 4 Decodable/Encodable (and Codable) allow to have a better interface to serialize objects

We can

  • write to file an Encodable object
  • write to file an array of Encodable objects
  • read from file an Decodable object
  • read from file an array of Decodable objects

That could be done only after merging #49

Support for hard links

Hi, I just ran into a case where I had to user a hard link instead of a symlink and had to fall back to NSFileManager to accomplish it. The API is almost identical to the symlink function:

createSymbolicLinkAtURL(_:withDestinationURL:)
createSymbolicLinkAtPath(_:withDestinationPath:)
linkItemAtURL(_:toURL:)
linkItemAtPath(_:toPath:)

Docs: https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/index.html#//apple_ref/doc/uid/20000305-SW30

Thanks! If I have some time I'll add this and submit a PR, but I wanted to at least raise the flag so the issue is logged.

Typo in ReadMe?

+>! Operator

Forcibly copies the file at the left path to the right path by deleting anything at the left path before copying the file.

Should that be "Forcibly copies the file at the left path to the right path by deleting anything at the RIGHT path before copying the file." ? If not, wouldn't it be a move instead of a copy?

del

del, sorry, found everything

Cannot call value of non-function type 'FileType?'

Hi,
I'm getting a compiler error when building my macOS app using FileKit integrated with Cocoapods.

The app is for macOS 10.13. I'm using Xcode 9.0.1, Cocoapods and FileKit 4.0.1 (5.0.0 was not available over Cocoapods)

If I want to compile the I getting this error:

Cannot call value of non-function type 'FileType?' in

extension File: CustomStringConvertible {

    // MARK: - CustomStringConvertible

    /// A textual representation of `self`.
    public var description: String {
        return String(describing: type(of: self)) + "('" + path.description + "')"
    }

}

Cannot create directory/file with name has slash character.

let shared = Path.userDocuments
let x = shared + "h/ai"
try? x.createDirectory(withIntermediateDirectories: true)
let sample = TextFile(path: shared/"filekit_sample.txt")
try? sample.write("Hello there!")
try? sample.read()

This code always create two directory h and sub directory ai.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.