Skip to content

Commit

Permalink
Merge branch 'hotfix-1.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswayoub committed May 14, 2014
2 parents ea19231 + f13998e commit 269a17b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
30 changes: 24 additions & 6 deletions Vagrant Manager/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -910,12 +910,7 @@ - (NSArray*)getAllVirtualMachinesInfo {
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/bash"];

if ([[NSFileManager defaultManager] isReadableFileAtPath:@"/etc/exports"]) {
[task setArguments:@[@"-c", @"VBoxManage list vms | grep -Eo '[^ ]+$' | sed -e 's/[{}]//g' | grep -vFf <(cat /etc/exports | grep 'VAGRANT' | grep -Eo '[^ ]+$' | uniq)"]];
} else {
[task setArguments:@[@"-c", @"VBoxManage list vms | grep -Eo '[^ ]+$' | sed -e 's/[{}]//g'"]];
}

[task setArguments:@[@"-c", @"VBoxManage list vms | grep -Eo '[^ ]+$' | sed -e 's/[{}]//g'"]];

NSPipe *pipe = [NSPipe pipe];
[task setStandardInput:[NSPipe pipe]];
Expand All @@ -932,6 +927,29 @@ - (NSArray*)getAllVirtualMachinesInfo {

NSMutableArray *virtualMachines = [[NSMutableArray alloc] init];

//remove nfs machines
if ([[NSFileManager defaultManager] isReadableFileAtPath:@"/etc/exports"]) {
task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/bash"];

[task setArguments:@[@"-c", @"cat /etc/exports | grep '# VAGRANT-' | grep -Eo '[^ ]+$' | sort -u"]];

pipe = [NSPipe pipe];
[task setStandardInput:[NSPipe pipe]];
[task setStandardOutput:pipe];

[task launch];
[task waitUntilExit];

outputData = [[pipe fileHandleForReading] readDataToEndOfFile];
outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding];

NSMutableArray *nfsVmUuids = [[outputString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] mutableCopy];
[nfsVmUuids removeObject:@""];

[vmUuids removeObjectsInArray:nfsVmUuids];
}

for(NSString *uuid in vmUuids) {
VirtualMachineInfo *vmInfo = [self getVirtualMachineInfo:uuid];
if(vmInfo) {
Expand Down
2 changes: 1 addition & 1 deletion Vagrant Manager/Vagrant Manager-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.2</string>
<string>1.4.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
7 changes: 6 additions & 1 deletion Vagrant Manager/VirtualMachineInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ + (VirtualMachineInfo*)fromInfo:(NSString*)infoString {
}

- (NSString*)getSharedFolderPathWithName:(NSString*)name {
return [self.sharedFolders objectForKey:name];
NSString *folder = [self.sharedFolders objectForKey:name];
if(!folder && [[name substringToIndex:1] isEqualToString:@"/"]) {
folder = [self.sharedFolders objectForKey:[name substringFromIndex:1]];
}

return folder;
}

- (BOOL)isRunning {
Expand Down

0 comments on commit 269a17b

Please sign in to comment.