summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-04-02 23:47:43 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-04-02 23:47:43 +0000
commita870a3f925fe2dd16a60f48a956af772988b805b (patch)
tree67af056885662f73d181898f742a7c03a3898a34 /src
parent99% German translation update. (diff)
downloadinkscape-a870a3f925fe2dd16a60f48a956af772988b805b.tar.gz
inkscape-a870a3f925fe2dd16a60f48a956af772988b805b.zip
Fix command line invocation on Windows (LP #167455).
Fixed bugs: - https://launchpad.net/bugs/167455 (bzr r9281)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp21
-rw-r--r--src/prefix.cpp8
-rw-r--r--src/prefix.h15
-rw-r--r--src/ui/dialog/glyphs.cpp4
-rw-r--r--src/ui/dialog/glyphs.h2
5 files changed, 15 insertions, 35 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5aa164df8..9f7bc9ad3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -593,22 +593,7 @@ main(int argc, char **argv)
#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
@@ -620,11 +605,7 @@ main(int argc, char **argv)
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 8c1dd4f00..92409a7d2 100644
--- a/src/prefix.cpp
+++ b/src/prefix.cpp
@@ -435,11 +435,11 @@ br_extract_prefix (const char *path)
/**
* 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);
@@ -481,7 +481,7 @@ static Glib::ustring win32_getResourcePath(const Glib::ustring &childPath)
*/
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 0c2db5b58..af96fa746 100644
--- a/src/prefix.h
+++ b/src/prefix.h
@@ -114,20 +114,19 @@ char *br_strcat (const char *str1, const char *str2);
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_ */
diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp
index 1c875e8cc..bc96b0575 100644
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
@@ -159,8 +159,8 @@ GlyphColumns *GlyphsPanel::getColumns()
/**
* 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 49ead3d6b..b4876f3c1 100644
--- a/src/ui/dialog/glyphs.h
+++ b/src/ui/dialog/glyphs.h
@@ -43,7 +43,7 @@ class GlyphColumns;
class GlyphsPanel : public Inkscape::UI::Widget::Panel
{
public:
- GlyphsPanel(gchar const *prefsPath = "/dialogs/glyphs");
+ GlyphsPanel();
virtual ~GlyphsPanel();
static GlyphsPanel& getInstance();