From 59bf5cd1368061a70c6e85eafac1e216ea0bd1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 10 Jun 2007 20:09:22 +0000 Subject: [PATCH] Fix broken help menu item on Windows. Add additional directory separator to generated READMEs. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1608 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 6 ++++-- src/callbacks.c | 12 +++++++++--- src/utils.c | 9 +++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b18dfd66..2cccbd8bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,13 +4,15 @@ symbol list item. * src/build.c: Hide Next Error menu item and unnecessary separator from build menu on Windows. + * src/callbacks.c: Fix broken help menu item on Windows. + * src/utils.c: Add additional directory separator to generated READMEs. 2007-06-09 Enrico Tröger * THANKS, src/document.c: - Apply from François Cami and Guillaume Duviol to improve replacement - of tabs by spaces (thank you). + Apply patch from François Cami and Guillaume Duviol to improve + replacement of tabs by spaces (thank you). * src/templates.c: Change PHP short open tag to the full open tag. * src/document.c: Prevent hang if searching for a regular expression fails (closes #1733676). diff --git a/src/callbacks.c b/src/callbacks.c index 9eaeda3da..242ff5e1b 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -1391,13 +1391,19 @@ void on_help1_activate (GtkMenuItem *menuitem, gpointer user_data) { + gint skip; + gchar *uri; + #ifdef G_OS_WIN32 - gchar *uri = g_strconcat("file:///", g_path_skip_root(app->docdir), "/index.html", NULL); + skip = 8; + uri = g_strconcat("file:///", app->docdir, "/index.html", NULL); + g_strdelimit(uri, "\\", '/'); // replace '\\' by '/' #else - gchar *uri = g_strconcat("file://", app->docdir, "index.html", NULL); + skip = 7; + uri = g_strconcat("file://", app->docdir, "index.html", NULL); #endif - if (! g_file_test(uri + 7, G_FILE_TEST_IS_REGULAR)) + if (! g_file_test(uri + skip, G_FILE_TEST_IS_REGULAR)) { // fall back to online documentation if it is not found on the hard disk g_free(uri); uri = g_strconcat(GEANY_HOMEPAGE, "manual/index.html", NULL); diff --git a/src/utils.c b/src/utils.c index 3c8b011b3..e3bfd240b 100644 --- a/src/utils.c +++ b/src/utils.c @@ -812,6 +812,11 @@ gint utils_make_settings_dir(const gchar *dir, const gchar *data_dir, const gcha { // try to write geany.conf error_nr = access(app->configdir, W_OK); } +#ifdef G_OS_WIN32 +# define DIR_SEP "\\" // on Windows we need an additional dir separator +#else +# define DIR_SEP "" +#endif // make subdir for filetype definitions if (error_nr == 0) @@ -828,7 +833,7 @@ gint utils_make_settings_dir(const gchar *dir, const gchar *data_dir, const gcha gchar *text = g_strconcat( "Copy files from ", data_dir, " to this directory to overwrite " "them. To use the defaults, just delete the file in this directory.\nFor more information read " -"the documentation (in ", doc_dir, "index.html or visit " GEANY_HOMEPAGE ").", NULL); +"the documentation (in ", doc_dir, DIR_SEP "index.html or visit " GEANY_HOMEPAGE ").", NULL); utils_write_file(filedefs_readme, text); g_free(text); } @@ -849,7 +854,7 @@ gint utils_make_settings_dir(const gchar *dir, const gchar *data_dir, const gcha { gchar *text = g_strconcat( "There are several template files in this directory. For these templates you can use wildcards.\n\ -For more information read the documentation (in ", doc_dir, "index.html or visit " GEANY_HOMEPAGE ").", +For more information read the documentation (in ", doc_dir, DIR_SEP "index.html or visit " GEANY_HOMEPAGE ").", NULL); utils_write_file(templates_readme, text); g_free(text);