Revision: 7764
http://skim-app.svn.sourceforge.net/skim-app/?rev=7764&view=rev
Author: hofman
Date: 2012-11-01 16:59:00 +0000 (Thu, 01 Nov 2012)
Log Message:
-----------
Replace more path based code by URL based code
Modified Paths:
--------------
trunk/NSString_SKExtensions.h
trunk/NSString_SKExtensions.m
trunk/NSURL_SKExtensions.h
trunk/NSURL_SKExtensions.m
trunk/SKConversionProgressController.m
trunk/SKMainDocument.m
Modified: trunk/NSString_SKExtensions.h
===================================================================
--- trunk/NSString_SKExtensions.h 2012-11-01 16:06:57 UTC (rev 7763)
+++ trunk/NSString_SKExtensions.h 2012-11-01 16:59:00 UTC (rev 7764)
@@ -49,8 +49,6 @@
- (NSString *)stringByAppendingEllipsis;
-- (NSString *)lastPathComponentReplacingPathExtension:(NSString *)ext;
-
- (NSString *)stringByBackslashEscapingCharactersFromSet:(NSCharacterSet
*)charSet;
- (NSString *)stringByEscapingShellChars;
- (NSString *)stringByEscapingParenthesis;
Modified: trunk/NSString_SKExtensions.m
===================================================================
--- trunk/NSString_SKExtensions.m 2012-11-01 16:06:57 UTC (rev 7763)
+++ trunk/NSString_SKExtensions.m 2012-11-01 16:59:00 UTC (rev 7764)
@@ -253,11 +253,6 @@
return [self stringByAppendingFormat:@"%C", ELLIPSIS_CHARACTER];
}
-- (NSString *)lastPathComponentReplacingPathExtension:(NSString *)ext;
-{
- return [[[self lastPathComponent] stringByDeletingPathExtension]
stringByAppendingPathExtension:ext];
-}
-
- (NSString *)stringByBackslashEscapingCharactersFromSet:(NSCharacterSet
*)charSet {
NSUInteger location = [self rangeOfCharacterFromSet:charSet].location;
if (location == NSNotFound)
Modified: trunk/NSURL_SKExtensions.h
===================================================================
--- trunk/NSURL_SKExtensions.h 2012-11-01 16:06:57 UTC (rev 7763)
+++ trunk/NSURL_SKExtensions.h 2012-11-01 16:59:00 UTC (rev 7764)
@@ -47,6 +47,7 @@
+ (NSArray *)readFileURLsFromPasteboard:(NSPasteboard *)pboard;
- (NSURL *)URLReplacingPathExtension:(NSString *)ext;
+- (NSString *)lastPathComponentReplacingPathExtension:(NSString *)ext;
- (NSAttributedString *)icon;
- (NSAttributedString *)smallIcon;
Modified: trunk/NSURL_SKExtensions.m
===================================================================
--- trunk/NSURL_SKExtensions.m 2012-11-01 16:06:57 UTC (rev 7763)
+++ trunk/NSURL_SKExtensions.m 2012-11-01 16:59:00 UTC (rev 7764)
@@ -113,6 +113,10 @@
return [[self URLByDeletingPathExtension] URLByAppendingPathExtension:ext];
}
+- (NSString *)lastPathComponentReplacingPathExtension:(NSString *)ext {
+ return [[self URLReplacingPathExtension:ext] lastPathComponent];
+}
+
- (NSAttributedString *)icon {
NSAttributedString *attrString = nil;
Modified: trunk/SKConversionProgressController.m
===================================================================
--- trunk/SKConversionProgressController.m 2012-11-01 16:06:57 UTC (rev
7763)
+++ trunk/SKConversionProgressController.m 2012-11-01 16:59:00 UTC (rev
7764)
@@ -50,7 +50,7 @@
#define PROVIDER_KEY @"provider"
#define CONSUMER_KEY @"consumer"
-#define INPUTFILE_KEY @"inputFile"
+#define INPUTURL_KEY @"inputURL"
#define PDFDATA_KEY @"pdfData"
#define TOOLPATH_KEY @"toolPath"
@@ -322,12 +322,13 @@
- (void)doDVIConversionWithInfo:(NSDictionary *)info {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSString *dviFile = [info objectForKey:INPUTFILE_KEY];
+ NSURL *dviURL = [info objectForKey:INPUTURL_KEY];
+ NSString *dviFile = [dviURL path];
NSString *commandPath = [info objectForKey:TOOLPATH_KEY];
NSString *commandName = [commandPath lastPathComponent];
NSString *tmpDir = SKUniqueTemporaryDirectory();
BOOL outputPS = [commandName isEqualToString:@"dvips"];
- NSString *outFile = [tmpDir stringByAppendingPathComponent:[dviFile
lastPathComponentReplacingPathExtension:outputPS ? @"ps" : @"pdf"]];
+ NSString *outFile = [tmpDir stringByAppendingPathComponent:[dviURL
lastPathComponentReplacingPathExtension:outputPS ? @"ps" : @"pdf"]];
NSArray *arguments = [commandName isEqualToString:@"dvipdf"] ? [NSArray
arrayWithObjects:dviFile, outFile, nil] : [NSArray arrayWithObjects:@"-o",
outFile, dviFile, nil];
BOOL success = NO;
@@ -394,7 +395,7 @@
NSAssert(converter != NULL, @"unable to create PS converter");
}
- NSDictionary *dictionary = [NSDictionary
dictionaryWithObjectsAndKeys:[dviURL path], INPUTFILE_KEY, pdfData,
PDFDATA_KEY, toolPath, TOOLPATH_KEY, nil];
+ NSDictionary *dictionary = [NSDictionary
dictionaryWithObjectsAndKeys:dviURL, INPUTURL_KEY, pdfData, PDFDATA_KEY,
toolPath, TOOLPATH_KEY, nil];
NSInteger rv = [self runModalSelector:@selector(doDVIConversionWithInfo:)
withObject:dictionary];
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2012-11-01 16:06:57 UTC (rev 7763)
+++ trunk/SKMainDocument.m 2012-11-01 16:59:00 UTC (rev 7764)
@@ -1138,12 +1138,12 @@
}
- (IBAction)saveArchive:(id)sender {
- NSString *path = [[self fileURL] path];
- if (path && [[NSFileManager defaultManager] fileExistsAtPath:path] &&
[self isDocumentEdited] == NO) {
+ NSURL *fileURL = [self fileURL];
+ if (fileURL && [[NSFileManager defaultManager] fileExistsAtPath:[fileURL
path]] && [self isDocumentEdited] == NO) {
NSSavePanel *sp = [NSSavePanel savePanel];
[sp setRequiredFileType:@"tgz"];
[sp setCanCreateDirectories:YES];
- [sp setNameFieldStringValue:[path
lastPathComponentReplacingPathExtension:@"tgz"]];
+ [sp setNameFieldStringValue:[fileURL
lastPathComponentReplacingPathExtension:@"tgz"]];
[sp beginSheetModalForWindow:[self windowForSheet]
completionHandler:^(NSInteger result){
if (NSFileHandlingPanelOKButton == result && [self fileURL])
[self saveArchiveToFile:[[sp URL] path]];
@@ -1229,7 +1229,7 @@
NSString *path = [[self fileURL] path];
if (path && [[NSFileManager defaultManager] fileExistsAtPath:path] &&
[self isDocumentEdited] == NO) {
NSString *tmpDir = SKUniqueChewableItemsDirectory();
- NSString *tmpFile = [tmpDir stringByAppendingPathComponent:[[[self
fileURL] path] lastPathComponentReplacingPathExtension:@"tgz"]];
+ NSString *tmpFile = [tmpDir stringByAppendingPathComponent:[[self
fileURL] lastPathComponentReplacingPathExtension:@"tgz"]];
if ([self saveArchiveToFile:tmpFile] == NO || [self
emailAttachmentFile:tmpFile] == NO)
NSBeep();
} else {
@@ -1266,12 +1266,12 @@
}
- (IBAction)saveDiskImage:(id)sender {
- NSString *path = [[self fileURL] path];
- if (path && [[NSFileManager defaultManager] fileExistsAtPath:path] &&
[self isDocumentEdited] == NO) {
+ NSURL *fileURL = [self fileURL];
+ if (fileURL && [[NSFileManager defaultManager] fileExistsAtPath:[fileURL
path]] && [self isDocumentEdited] == NO) {
NSSavePanel *sp = [NSSavePanel savePanel];
[sp setRequiredFileType:@"dmg"];
[sp setCanCreateDirectories:YES];
- [sp setNameFieldStringValue:[path
lastPathComponentReplacingPathExtension:@"dmg"]];
+ [sp setNameFieldStringValue:[fileURL
lastPathComponentReplacingPathExtension:@"dmg"]];
[sp beginSheetModalForWindow:[self windowForSheet]
completionHandler:^(NSInteger result){
if (NSFileHandlingPanelOKButton == result && [self fileURL])
[self saveDiskImageToFile:[[sp URL] path] email:NO];
@@ -1286,7 +1286,7 @@
NSString *path = [[self fileURL] path];
if (path && [[NSFileManager defaultManager] fileExistsAtPath:path] &&
[self isDocumentEdited] == NO) {
NSString *tmpDir = SKUniqueChewableItemsDirectory();
- NSString *tmpFile = [tmpDir stringByAppendingPathComponent:[[[self
fileURL] path] lastPathComponentReplacingPathExtension:@"dmg"]];
+ NSString *tmpFile = [tmpDir stringByAppendingPathComponent:[[self
fileURL] lastPathComponentReplacingPathExtension:@"dmg"]];
[self saveDiskImageToFile:tmpFile email:YES];
} else {
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"You
must save this file first", @"Alert text when trying to create archive for
unsaved document") defaultButton:nil alternateButton:nil otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"The document has unsaved changes,
or has not previously been saved to disk.", @"Informative text in alert
dialog")];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit