Adding missing NSString methods from NSPathUtilities.h #30
Conversation
/cc @kumpera ;) |
I'm not a maintainer of maccore, sorry. But let's review it! PathComponents returns an array of strings, right? Why not change the return value to "string[]"? This would provide |
Yeah, that's what i thought first, but since there are many calls that do return |
+1 |
1 similar comment
+1 |
// methods from the category NSStringPathExtensions | ||
|
||
[Export ("pathComponents")] | ||
NSArray PathComponents(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not return NSArray from maccore's public APIs, unless there is a strong reason to. We use strongly typed C# arrays
I am actually confused about the comment for this commit. These look purely like string operations on a path, it does not look like they would ever touch the file system, so I am confused as to why we would want these. |
That's where the path handling methods are in Cocoa, they are (almost exclusively) in the NSString class. Given this is where people using Objective-C (or searching for these methods) are going to look for I think it's better if they are kept in the same place Objective-C shows them. Will do the other changes. |
@migueldeicaza now I have made the fields that are properties in Objective-C to also be properties in C# (didn't know how to do that) and all methods now return either These path utilites methods are needed (at least in our case) because they are the only way to "standarize" symlinks to their real paths, since there is no such concept at |
I wish stringByStandardizingPath was in MonoTouch. I'm not sure my string.Replace-s are correct. |
@gaearon we just keep our own private branch here. It's unfortunate but it's necessary since it doesn't look like this will ever be accepted. |
string[] PathComponents { [Bind("pathComponents")] get; } | ||
|
||
[Export("isAbsolutePath")] | ||
bool AbsolutePath { [Bind("isAbsolutePath")] get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename "IsAbsolutePath"
I am willing to get these changes, but there are a few things that need to change: (a) there is a bug in the names referenced, so those need to be fixed. |
There are too many other commits on this one, I'm going to create a new one with these changes since this branch has gone too far away from what this PR means. |
New PR available at #42 |
These methods are part of Foundation (both on MacOS and iOS), but are declared at NSPathUtilities. They were not available on maccore and I need them to do some file name cleanups (that can't be done on System.IO as System.IO doesn't handle symlinks).