Closed itsallmememe closed 5 years ago
Can we document that we don’t know what these return on Linux, unless we know. Do we know?
Also I will probably try to get them returning something in the nil
case, just FYI, where possible anyway. Like a sensible default. I can do this after merging.
Can we document that we don’t know what these return on Linux, unless we know. Do we know?
I don't, but I'll find out over the weekend :)
Also I will probably try to get them returning something in the
nil
case, just FYI, where possible anyway. Like a sensible default. I can do this after merging.
Yeah, I agree, I wasn't too sure what to return tho. If the expectation that the library returns a path to the Documents folder, but it returns a different address without acknowledgement then it's a little misleading.
If the expectation that the library returns a path to the Documents folder, but it returns a different address without acknowledgement then it's a little misleading.
I think for Documents defaulting to ~/Documents is fine on everything but Linux and on Linux we can consult the Free Desktop specification.
I'm going with the principal that the developer would rather have a path that is reasonable for the very unlikely case that Apple don't give us something than have to handle the optional and show an error message (or do no error handling, which let's face it: is more frequently the case).
This is how I generally write my libraries anyway: do something sensible if possible, but don't go crazy. Some of these paths it might be a bad idea to return if we can't, I'll vet them individually.
Additionally: I just merged a PR from myself that officially adds support for iOS (etc.). You may want to rebase.
I noticed that the project isn't labelled as "iOS" compatible, yet it appears to works fine.
I added some hooks for iOS common directories - Documents, Caches and Application Support. These are also compatible with MacOS too.
These are optional as the NSFileManager has no direct hooks to them, and thus returns an array of paths. I figured Optionals were better than a
throw
or apreconditionFailure