Skip to content

Commit

Permalink
Reimplement determination of sysdatadir on windows with g_get_dirname…
Browse files Browse the repository at this point in the history
… (argv[0]) and not convert path to POSIX seps before passing to dialog_about (g_spawn is only one not handling path correctly).
  • Loading branch information
David C. Rankin committed Aug 14, 2017
1 parent 5c43650 commit 680e28f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,13 @@ To build either on win32 and enable the `-subsystem,windows` link option, add

$ make ss=-DWIN

Both **GtkEdit** and **GtkWrite** will compile with either MinGW or TDM-MinGW compilers. If you choose TDM-MinGW (separately or as part of CodeBlocks for windows), you will need to adjust the Makefile as the windows version of mkdir is used. On either, you will need to softlink `libxml2.dll` to `libxml2-2.dll` to run `gtkwrite`. After installing MinGW, the packages required to compile on windows are:
Both **GtkEdit** and **GtkWrite** will compile with either MinGW or TDM-MinGW compilers. If you choose TDM-MinGW (separately or as part of CodeBlocks for windows), you will need to adjust the Makefile as the windows version of mkdir is used. After installing MinGW, the packages required to compile on windows are:

* [https://download.gnome.org/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip](https://download.gnome.org/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip)
* [https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-2.10.0.zip](https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-2.10.0.zip)
* [https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-dev-2.10.0.zip](https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-dev-2.10.0.zip)
* [http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip](http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip)
* [https://download.gnome.org/binaries/win32/dependencies/libxml2_2.9.0-1_win32.zip](https://download.gnome.org/binaries/win32/dependencies/libxml2_2.9.0-1_win32.zip)

(Msys has `libxml2` available, but it requires adding it to your path if you use it)

Expand All @@ -144,4 +145,6 @@ On Linux, the default location for the configuration file is `$HOME/.config/gtkw

On Linux system wide syntax color-schemes (styles) are found in `/usr/share/gtksourceview-2.0/styles` and personal styles can be added in `$HOME/.local/share/gtksourceview-2.0/styles`. On win32, the system wide style directory will depend on where you installed the gtksourceview2 files, any personal styles can be placed in `%LOCALAPPDATA%\gtksourceview-2.0\styles`.

On Windows, where you install the gtkwrite.exe executable is irrelevant to the operation of the editor. However, until an installer is created, to have the GPL license and logo displayed in help-about you should install to `C:/Program Files/gtkwrite` (on 32-bit versions) or to `C:/Program Files (x86)/gtkwrite` for 64-bit versions. (include the `gpl-2.0.txt` file and the `img` directory in that the same location)

Give it a try, help make it better. Drop me a line if you have any questions.
33 changes: 9 additions & 24 deletions gtk_appdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,20 @@ static gboolean chk_key_ok (GError **err)
return TRUE;
}

/** set user data dir and system data dir */
static void set_data_dirs (kwinst *app)
{
gchar *usrdata = get_posix_filename (g_get_user_data_dir());
app->usrdatadir = g_strdup_printf ("%s/%s", usrdata, CFGDIR);
g_free (usrdata);
#ifndef HAVEMSWIN
app->sysdatadir = g_strdup (NIXSHARE);
#else
/* test whether C:/Program Files (x86) exists and use the
* 8 char mangled progra~2 if it does, otherwise use progra~1
* TODO: write routine that simply replaces check for
* "Program Files (x86)" and then "Program Files", replacing each
* with the mangled name in app->exename directly, then simply use
* the concatenation of dir from app->exename and IMGDIR and LOGONAME.
*/
if (g_file_test (WINPRG86))
app->sysdatadir = g_strdup (WINPRG86);
else
app->sysdatadir = g_strdup (WINPRG);
#endif
}

/** set default values for application & initialize variables */
static void context_set_defaults (kwinst *app, char **argv)
{
app->exename = get_posix_filename (argv[0]); /* executable name */
app->user = g_get_user_name (); /* system username */
set_data_dirs (app);
#ifndef HAVEMSWIN
app->usrdatadir = g_strdup_printf ("%s/%s", g_get_user_data_dir(), CFGDIR);
app->sysdatadir = g_strdup (NIXSHARE);
#else
gchar *usrdata = get_posix_filename (g_get_user_data_dir());
app->usrdatadir = g_strdup_printf ("%s/%s", usrdata, CFGDIR);
app->sysdatadir = g_strdup (g_path_get_dirname(argv[0]));
g_free (usrdata);
#endif
#ifdef DEBUG
g_print ("app->exename : %s\n"
"app->user : %s\n"
Expand Down

0 comments on commit 680e28f

Please sign in to comment.