summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 243e0b9)
raw | patch | inline | side by side (parent: 243e0b9)
author | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Fri, 2 Apr 2010 23:47:43 +0000 (01:47 +0200) | ||
committer | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Fri, 2 Apr 2010 23:47:43 +0000 (01:47 +0200) |
diff --git a/src/main.cpp b/src/main.cpp
index 5aa164df8b072a44d70df1da2bbac088589d1366..9f7bc9ad33d7d9bb9f00d329454eb980a89cf6e3 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
#endif
#ifdef WIN32
- /*
- Set the current directory to the directory of the
- executable. This seems redundant, but is needed for
- when inkscape.exe is executed from another directory.
- We use relative paths on win32.
- HKCR\svgfile\shell\open\command is a good example
-
- TODO: this breaks the CLI on Windows, see LP #167455
- */
- const int pathbuf = 2048;
- gunichar2 *path = g_new(gunichar2, pathbuf);
- GetModuleFileNameW(NULL, (WCHAR*) path, pathbuf);
- gchar *inkscape = g_utf16_to_utf8(path, -1, NULL, NULL, NULL);
- gchar *exedir = g_path_get_dirname(inkscape);
- gunichar2 *dirw = g_utf8_to_utf16(exedir, -1, NULL, NULL, NULL);
- SetCurrentDirectoryW((WCHAR*) dirw);
+ gchar *exedir = g_strdup(win32_getExePath().data());
_win32_set_inkscape_env(exedir);
# ifdef ENABLE_NLS
g_free(shortexedir);
g_free(localepath);
# endif
-
- g_free(path);
- g_free(inkscape);
g_free(exedir);
- g_free(dirw);
// Don't touch the registry (works fine without it) for Inkscape Portable
gchar const *val = g_getenv("INKSCAPE_PORTABLE_PROFILE_DIR");
diff --git a/src/prefix.cpp b/src/prefix.cpp
index 8c1dd4f0022857dff53fef33a80e8c10f77c961b..92409a7d2c3dc3aff3e60c7c89b9a8acff1eb221 100644 (file)
--- a/src/prefix.cpp
+++ b/src/prefix.cpp
/**
* Return the directory of the .exe that is currently running
*/
-static Glib::ustring win32_getExePath()
+Glib::ustring win32_getExePath()
{
gunichar2 path[2048];
- GetModuleFileNameW(NULL, (WCHAR*) path, 2048);
- gchar *exe = g_utf16_to_utf8(path, -1, NULL, NULL, NULL);
+ GetModuleFileNameW(0, (WCHAR*) path, 2048);
+ gchar *exe = g_utf16_to_utf8(path, -1, 0,0,0);
gchar *dir = g_path_get_dirname(exe);
Glib::ustring ret = dir;
g_free(dir);
*/
char *win32_relative_path(const char *childPath)
{
- static char *returnPath = NULL;
+ static char *returnPath = 0;
if (!childPath)
childPath = "";
Glib::ustring resourcePath = win32_getResourcePath(childPath);
diff --git a/src/prefix.h b/src/prefix.h
index 0c2db5b58a6e0eca98095d69ef88aac720bc3106..af96fa74679b202f0a2d4be4e82380ce059b34b8 100644 (file)
--- a/src/prefix.h
+++ b/src/prefix.h
char *br_extract_dir (const char *path);
char *br_extract_prefix(const char *path);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#ifdef __WIN32__
-/**
- * Win32 version of a relocatable function
- */
+#include <glibmm/ustring.h>
+
+Glib::ustring win32_getExePath();
char *win32_relative_path(const char *childPath);
#define WIN32_DATADIR(suffix) (win32_relative_path(suffix))
#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* _PREFIX_H_ */
index 1c875e8cc20cbe3f4d64a894f49460f5c8bb7d75..bc96b05754d0173cfe25d261bcade3d191d5a8c1 100644 (file)
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
/**
* Constructor
*/
-GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
- Inkscape::UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_GLYPHS, "", false),
+GlyphsPanel::GlyphsPanel() :
+ Inkscape::UI::Widget::Panel("", "/dialogs/glyphs", SP_VERB_DIALOG_GLYPHS, "", false),
store(Gtk::ListStore::create(*getColumns())),
iconView(0),
entry(0),
diff --git a/src/ui/dialog/glyphs.h b/src/ui/dialog/glyphs.h
index 49ead3d6bc763c1f1653fac8697a1f6088422072..b4876f3c16366d5bd0f0d0b9d3b7a81f794a0a09 100644 (file)
--- a/src/ui/dialog/glyphs.h
+++ b/src/ui/dialog/glyphs.h
class GlyphsPanel : public Inkscape::UI::Widget::Panel
{
public:
- GlyphsPanel(gchar const *prefsPath = "/dialogs/glyphs");
+ GlyphsPanel();
virtual ~GlyphsPanel();
static GlyphsPanel& getInstance();