From 8915074c6393bdc5cbaa7900299122f0d4e365be Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 19 Aug 2010 13:57:15 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20SPFileManagerAdditions=20-=20[(NSSt?= =?UTF-8?q?ring*)applicationSupportDirectoryForSubDirectory:error:]=20Retu?= =?UTF-8?q?rn=20the=20application=20support=20folder=20of=20the=20current?= =?UTF-8?q?=20application=20for=20'subDirectory'.=20If=20this=20folder=20d?= =?UTF-8?q?oesn't=20exist=20it=20will=20be=20created.=20If=20'subDirectory?= =?UTF-8?q?'=20=3D=3D=20nil=20it=20only=20returns=20the=20application=20su?= =?UTF-8?q?pport=20folder=20of=20the=20current=20application.=20=E2=80=A2?= =?UTF-8?q?=20added=20SPThemesSupportFolder=20constant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPAppController.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Source/SPAppController.m') diff --git a/Source/SPAppController.m b/Source/SPAppController.m index b03603bd..88890c46 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -424,14 +424,20 @@ [spfs release]; } else if([[[filename pathExtension] lowercaseString] isEqualToString:[SPColorThemeFileExtension lowercaseString]]) { + NSFileManager *fm = [NSFileManager defaultManager]; - NSString *themePath = [[NSString stringWithString:@"~/Library/Application Support/Sequel Pro/Themes"] stringByExpandingTildeInPath]; + + NSString *themePath = [[NSFileManager defaultManager] applicationSupportDirectoryForSubDirectory:SPThemesSupportFolder error:nil]; + + if(!themePath) return; + if(![fm fileExistsAtPath:themePath isDirectory:nil]) { if(![fm createDirectoryAtPath:themePath withIntermediateDirectories:YES attributes:nil error:nil]) { NSBeep(); return; } } + NSString *newPath = [NSString stringWithFormat:@"%@/%@", themePath, [filename lastPathComponent]]; if(![fm fileExistsAtPath:newPath isDirectory:nil]) { if(![fm copyItemAtPath:filename toPath:newPath error:nil]) { -- cgit v1.2.3