From d26e56e2fd57da2dadddf760b2984956f7daa069 Mon Sep 17 00:00:00 2001 From: randomguy3 Date: Thu, 8 Mar 2012 17:36:48 +0000 Subject: GTK: fix creating the user support dir git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@418 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64 --- tikzit/src/common/SupportDir.m | 3 ++- tikzit/src/gtk/MainWindow.m | 4 +++- tikzit/src/gtk/mkdtemp.m | 26 +------------------------- tikzit/src/gtk/stat.h | 25 +++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 tikzit/src/gtk/stat.h diff --git a/tikzit/src/common/SupportDir.m b/tikzit/src/common/SupportDir.m index f0392b1..22fed1b 100644 --- a/tikzit/src/common/SupportDir.m +++ b/tikzit/src/common/SupportDir.m @@ -25,6 +25,7 @@ #ifndef __APPLE__ #import +#import "stat.h" #endif @implementation SupportDir @@ -55,7 +56,7 @@ error:NULL]; #else // NSFileManager is slightly dodgy on Windows - g_mkdir_with_parents ([[SupportDir userSupportDir] UTF8String], 700); + g_mkdir_with_parents ([[SupportDir userSupportDir] UTF8String], S_IRUSR | S_IWUSR | S_IXUSR); #endif } diff --git a/tikzit/src/gtk/MainWindow.m b/tikzit/src/gtk/MainWindow.m index c391ea5..6506125 100644 --- a/tikzit/src/gtk/MainWindow.m +++ b/tikzit/src/gtk/MainWindow.m @@ -45,6 +45,8 @@ #import "TikzDocument.h" #import "WidgetSurface.h" +#import "stat.h" + // {{{ Internal interfaces // {{{ Clipboard support @@ -462,7 +464,7 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc if (preambles != nil) { NSString *preamblesDir = [[SupportDir userSupportDir] stringByAppendingPathComponent:@"preambles"]; // NSFileManager is slightly dodgy on Windows - g_mkdir_with_parents ([preamblesDir UTF8String], 700); + g_mkdir_with_parents ([preamblesDir UTF8String], S_IRUSR | S_IWUSR | S_IXUSR); [preambles storeToDirectory:preamblesDir]; [configFile setStringEntry:@"selectedPreamble" inGroup:@"Preambles" value:[preambles selectedPreambleName]]; } diff --git a/tikzit/src/gtk/mkdtemp.m b/tikzit/src/gtk/mkdtemp.m index 0866e54..f6b73aa 100644 --- a/tikzit/src/gtk/mkdtemp.m +++ b/tikzit/src/gtk/mkdtemp.m @@ -60,31 +60,7 @@ # endif #endif -#include -#if STAT_MACROS_BROKEN -# undef S_ISDIR -#endif -#if !defined S_ISDIR && defined S_IFDIR -# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) -#endif -#if !S_IRUSR && S_IREAD -# define S_IRUSR S_IREAD -#endif -#if !S_IRUSR -# define S_IRUSR 00400 -#endif -#if !S_IWUSR && S_IWRITE -# define S_IWUSR S_IWRITE -#endif -#if !S_IWUSR -# define S_IWUSR 00200 -#endif -#if !S_IXUSR && S_IEXEC -# define S_IXUSR S_IEXEC -#endif -#if !S_IXUSR -# define S_IXUSR 00100 -#endif +#include "stat.h" #ifdef __MINGW32__ /* mingw's mkdir() function has 1 argument, but we pass 2 arguments. diff --git a/tikzit/src/gtk/stat.h b/tikzit/src/gtk/stat.h new file mode 100644 index 0000000..a9829ae --- /dev/null +++ b/tikzit/src/gtk/stat.h @@ -0,0 +1,25 @@ +#include +#if STAT_MACROS_BROKEN +# undef S_ISDIR +#endif +#if !defined S_ISDIR && defined S_IFDIR +# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif +#if !S_IRUSR && S_IREAD +# define S_IRUSR S_IREAD +#endif +#if !S_IRUSR +# define S_IRUSR 00400 +#endif +#if !S_IWUSR && S_IWRITE +# define S_IWUSR S_IWRITE +#endif +#if !S_IWUSR +# define S_IWUSR 00200 +#endif +#if !S_IXUSR && S_IEXEC +# define S_IXUSR S_IEXEC +#endif +#if !S_IXUSR +# define S_IXUSR 00100 +#endif -- cgit v1.2.3