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

Get Path action update #331

Merged
merged 12 commits into from May 31, 2011
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Quicksilver/Code-QuickStepCore/QSObject_StringHandling.m
Expand Up @@ -84,7 +84,7 @@ - (void)sniffString {
if ([stringValue hasPrefix:@"/"] || [stringValue hasPrefix:@"~"]) {
NSMutableArray *files = [[[stringValue componentsSeparatedByString:@"\n"] mutableCopy] autorelease];
[files removeObject:@""];
[files arrayByPerformingSelector:@selector(stringByStandardizingPath)];
files = (NSMutableArray *)[files arrayByPerformingSelector:@selector(stringByStandardizingPath)];
//NSString *path = [stringValue stringByStandardizingPath];
//NSLog(@"%@", files);
int line = -1;
Expand Down
6 changes: 3 additions & 3 deletions Quicksilver/Code-QuickStepFoundation/NSArray_BLTRExtensions.m
Expand Up @@ -47,10 +47,10 @@ - (id)head { return [self count] ? [self objectAtIndex:0] : nil; }
- (NSArray *)tail { return [self count] > 1 ? [self subarrayWithRange:NSMakeRange(1, [self count]-1)] : nil; }
- (NSArray *)arrayByPerformingSelector:(SEL)aSelector {
NSMutableArray *resultArray = [NSMutableArray arrayWithCapacity:[self count]];
int i;
id result;
for (i = 0; i<(int) [self count]; i++) {
result = [[self objectAtIndex:i] performSelector:aSelector];
for (id anObject in self)
{
result = [anObject performSelector:aSelector];
[resultArray addObject:(result?result:[NSNull null])];
}
return resultArray;
Expand Down
Expand Up @@ -685,6 +685,20 @@ - (QSObject *)makeHardLinkTo:(QSObject *)dObject inFolder:(QSObject *)iObject {
}

- (QSObject *)getFilePaths:(QSObject *)dObject {
// get an array of paths from files in the first pane
NSMutableArray *paths = [[dObject arrayForType:QSFilePathType] arrayByPerformingSelector:@selector(stringByAbbreviatingWithTildeInPath)];
// the name/label should be a one-line string
QSObject *pathResult = [QSObject objectWithName:[paths componentsJoinedByString:@", "]];
// use something other than the path to prevent this from clobbering the existing file (if it's in the catalog)
[pathResult setIdentifier:@"GetPathActionResult"];
// store all paths separated by newlines
// allow it to be used as text (Large Type, Paste, etc.)
[pathResult setObject:[paths componentsJoinedByString:@"\n"] forType:QSTextType];
[pathResult setPrimaryType:QSTextType];
return pathResult;
}

- (QSObject *)getAbsoluteFilePaths:(QSObject *)dObject {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to come late with this but since the method bodies of getFilePaths and getAbsoluteFilePaths only differ by the first line it may be worthwhile to factor out the common remainder into a separate method. But this can also be done independently from this pull...

// get an array of paths from files in the first pane
NSArray *paths = [dObject arrayForType:QSFilePathType];
// the name/label should be a one-line string
Expand Down
23 changes: 22 additions & 1 deletion Quicksilver/PlugIns-Main/QSCorePlugIn/QSCorePlugIn-Info.plist
Expand Up @@ -332,7 +332,7 @@
<string>NSFilenamesPboardType</string>
</array>
</dict>
<key>FileGetPosixPathAction</key>
<key>FileGetPathAction</key>
<dict>
<key>actionClass</key>
<string>FSActions</string>
Expand All @@ -350,6 +350,27 @@
<integer>1</integer>
<key>precedence</key>
<real>-0.5</real>
<key>alternateAction</key>
<string>FileGetPosixPathAction</string>
</dict>
<key>FileGetPosixPathAction</key>
<dict>
<key>actionClass</key>
<string>FSActions</string>
<key>actionSelector</key>
<string>getAbsoluteFilePaths:</string>
<key>directTypes</key>
<array>
<string>NSFilenamesPboardType</string>
</array>
<key>displaysResult</key>
<integer>1</integer>
<key>enabled</key>
<false/>
<key>feature</key>
<integer>1</integer>
<key>precedence</key>
<real>-0.5</real>
</dict>
<key>FileGetURLAction</key>
<dict>
Expand Down
Expand Up @@ -60,8 +60,10 @@
<string>Löschen</string>
<key>FileGetInfoAction</key>
<string>Infofenster</string>
<key>FileGetPathAction</key>
<string>Pfad</string>
<key>FileGetPosixPathAction</key>
<string>Pfad (POSIX)</string>
<string>Absoluter Pfad (POSIX)</string>
<key>FileGetURLAction</key>
<string>Pfad als URL</string>
<key>FileGetHFSPathAction</key>
Expand Down
Expand Up @@ -50,8 +50,10 @@
<string>Get HFS path of %@</string>
<key>FileGetInfoAction</key>
<string>Get info on %@</string>
<key>FileGetPosixPathAction</key>
<key>FileGetPathAction</key>
<string>Get posix path of %@</string>
<key>FileGetPosixPathAction</key>
<string>Get absolute path of %@</string>
<key>FileGetURLAction</key>
<string>Get file:// URL of %@</string>
<key>FileMakeAliasInAction</key>
Expand Down
Expand Up @@ -42,6 +42,10 @@
<string>Copy to another location</string>
<key>FileDecompressAction</key>
<string>Decompress file</string>
<key>FileGetPathAction</key>
<string>Get the path using ~</string>
<key>FileGetPosixPathAction</key>
<string>Get the absolute path (without ~)</string>
<key>FileMakeLinkInAction</key>
<string>Make link in another location</string>
<key>FileMoveToAction</key>
Expand Down
Expand Up @@ -58,8 +58,10 @@
<string>Delete (Erase)</string>
<key>FileGetInfoAction</key>
<string>Get Info</string>
<key>FileGetPosixPathAction</key>
<key>FileGetPathAction</key>
<string>Get Path</string>
<key>FileGetPosixPathAction</key>
<string>Get Absolute (POSIX) Path</string>
<key>FileGetURLAction</key>
<string>Get File URL</string>
<key>FileGetHFSPathAction</key>
Expand Down
Expand Up @@ -50,7 +50,7 @@
<string>Obtenir le chemin HFS de %@</string>
<key>FileGetInfoAction</key>
<string>Lire les informations de %@</string>
<key>FileGetPosixPathAction</key>
<key>FileGetPathAction</key>
<string>Obtenir le chemin POSIX de %@</string>
<key>FileGetURLAction</key>
<string>Obtenir l'URL file:// de %@</string>
Expand Down
Expand Up @@ -58,8 +58,10 @@
<string>Supprimer</string>
<key>FileGetInfoAction</key>
<string>Lire les informations</string>
<key>FileGetPosixPathAction</key>
<key>FileGetPathAction</key>
<string>Obtenir le chemin</string>
<key>FileGetPosixPathAction</key>
<string>Obtenir le chemin absolu (POSIX)</string>
<key>FileGetURLAction</key>
<string>Obtenir l'URL</string>
<key>FileGetHFSPathAction</key>
Expand Down