aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPAppController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-19 13:57:15 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-19 13:57:15 +0000
commit8915074c6393bdc5cbaa7900299122f0d4e365be (patch)
tree639dc351971b8b7661fa216ebfb41c9406fb2c0e /Source/SPAppController.m
parent6cf7762d7ae11c75698c11ffee0822b3ead24932 (diff)
downloadsequelpro-8915074c6393bdc5cbaa7900299122f0d4e365be.tar.gz
sequelpro-8915074c6393bdc5cbaa7900299122f0d4e365be.tar.bz2
sequelpro-8915074c6393bdc5cbaa7900299122f0d4e365be.zip
• added SPFileManagerAdditions
- [(NSString*)applicationSupportDirectoryForSubDirectory:error:] Return the application support folder of the current application for 'subDirectory'. If this folder doesn't exist it will be created. If 'subDirectory' == nil it only returns the application support folder of the current application. • added SPThemesSupportFolder constant
Diffstat (limited to 'Source/SPAppController.m')
-rw-r--r--Source/SPAppController.m8
1 files changed, 7 insertions, 1 deletions
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]) {