summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrandomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64>2012-01-08 15:59:43 +0000
committerrandomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64>2012-01-08 15:59:43 +0000
commit04c737bcffd1ed1f16b33c2a4199497c881c8502 (patch)
tree0e114831cebb45cc282776badb87c5f534f25f9a /src
parent14a4000aa9056d2fdc69c2dc925bc9a4203d068b (diff)
GTK: Use glib for directory creation.
NSFileManager's createDirectory methods do not appear to work properly on Windows. git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@358 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64
Diffstat (limited to 'src')
-rw-r--r--src/common/SupportDir.m6
-rw-r--r--src/linux/MainWindow.m3
2 files changed, 8 insertions, 1 deletions
diff --git a/src/common/SupportDir.m b/src/common/SupportDir.m
index 72acbf9..c014f4d 100644
--- a/src/common/SupportDir.m
+++ b/src/common/SupportDir.m
@@ -47,11 +47,17 @@
}
+ (void)createUserSupportDir {
+#ifdef __APPLE__
NSFileManager *fileManager = [NSFileManager defaultManager];
+ NSError *error = nil;
[fileManager createDirectoryAtPath:[SupportDir userSupportDir]
withIntermediateDirectories:YES
attributes:nil
error:NULL];
+#else
+ // NSFileManager is slightly dodgy on Windows
+ g_mkdir_with_parents ([[SupportDir userSupportDir] UTF8String], 700);
+#endif
}
@end
diff --git a/src/linux/MainWindow.m b/src/linux/MainWindow.m
index 4857cc4..c68c9e8 100644
--- a/src/linux/MainWindow.m
+++ b/src/linux/MainWindow.m
@@ -442,7 +442,8 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc
if (preambles != nil) {
NSString *preamblesDir = [[SupportDir userSupportDir] stringByAppendingPathComponent:@"preambles"];
- [[NSFileManager defaultManager] createDirectoryAtPath:preamblesDir withIntermediateDirectories:YES attributes:nil error:NULL];
+ // NSFileManager is slightly dodgy on Windows
+ g_mkdir_with_parents ([preamblesDir UTF8String], 700);
[preambles storeToDirectory:preamblesDir];
[configFile setStringEntry:@"selectedPreamble" inGroup:@"Preambles" value:[preambles selectedPreambleName]];
}