Compare commits
2 Commits
e0a1cf49e7
...
a640627fe1
Author | SHA1 | Date |
---|---|---|
Christopher Snowhill | a640627fe1 | |
Christopher Snowhill | 5550af7e64 |
|
@ -496,7 +496,37 @@ static AppController *kAppController = nil;
|
|||
NSMutableArray *urls = [NSMutableArray array];
|
||||
|
||||
for(NSString *filename in filenames) {
|
||||
[urls addObject:[NSURL fileURLWithPath:filename]];
|
||||
NSURL *url = nil;
|
||||
if([[NSFileManager defaultManager] fileExistsAtPath:filename]) {
|
||||
url = [NSURL fileURLWithPath:filename];
|
||||
} else {
|
||||
if([filename hasPrefix:@"/http/::"] ||
|
||||
[filename hasPrefix:@"/https/::"]) {
|
||||
// Stupid Carbon bodge for AppleScript
|
||||
NSString *method = nil;
|
||||
NSString *server = nil;
|
||||
NSString *path = nil;
|
||||
|
||||
NSScanner *objScanner = [NSScanner scannerWithString:filename];
|
||||
|
||||
if(![objScanner scanString:@"/" intoString:nil] ||
|
||||
![objScanner scanUpToString:@"/" intoString:&method] ||
|
||||
![objScanner scanString:@"/::" intoString:nil] ||
|
||||
![objScanner scanUpToString:@":" intoString:&server] ||
|
||||
![objScanner scanString:@":" intoString:nil]) {
|
||||
continue;
|
||||
}
|
||||
[objScanner scanUpToCharactersFromSet:[NSCharacterSet illegalCharacterSet] intoString:&path];
|
||||
// Colons in server were converted to shashes, convert back
|
||||
NSString *convertedServer = [server stringByReplacingOccurrencesOfString:@"/" withString:@":"];
|
||||
// Slashes in path were converted to colons, convert back
|
||||
NSString *convertedPath = [path stringByReplacingOccurrencesOfString:@":" withString:@"/"];
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@/%@", method, convertedServer, convertedPath]];
|
||||
}
|
||||
}
|
||||
if(url) {
|
||||
[urls addObject:url];
|
||||
}
|
||||
}
|
||||
|
||||
NSDictionary *loadEntriesData = @{ @"entries": urls,
|
||||
|
|
|
@ -594,11 +594,15 @@ static void http_stream_reset(HTTPSource *fp) {
|
|||
|
||||
[NSThread detachNewThreadSelector:@selector(threadEntry:) toTarget:self withObject:nil];
|
||||
|
||||
// Wait for transfer to at least start
|
||||
while(status == STATUS_UNSTARTED) {
|
||||
usleep(3000);
|
||||
}
|
||||
|
||||
while(status != STATUS_READING && curl) {
|
||||
// Now wait for it to either begin streaming, or complete if file is small enough to fit in the buffer
|
||||
while(status != STATUS_READING &&
|
||||
status != STATUS_FINISHED &&
|
||||
curl) {
|
||||
usleep(3000);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue