diff --git a/src/main.cpp b/src/main.cpp
index 5aa164df8b072a44d70df1da2bbac088589d1366..eda6d0b03ca9882163bf6ced1d040dca62ff4a84 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
#define bind_textdomain_codeset(p,c)
#endif
-#include "application/application.h"
#include "main-cmdlineact.h"
#include "widgets/icon.h"
#include "ui/widget/panel.h"
static gboolean sp_query_height = FALSE;
static gboolean sp_query_all = FALSE;
static gchar *sp_query_id = NULL;
-static int sp_new_gui = FALSE;
static gboolean sp_shell = FALSE;
static gboolean sp_vacuum_defs = FALSE;
#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");
}
#endif // WIN32
- /// \todo Should this be a static object (see inkscape.cpp)?
- Inkscape::NSApplication::Application app(argc, argv, use_gui, sp_new_gui);
+ int retcode;
+
+ if (use_gui) {
+ retcode = sp_main_gui(argc, (const char **) argv);
+ } else {
+ retcode = sp_main_console(argc, (const char **) argv);
+ }
- return app.run();
+ return retcode;
}
if (sp_export_area) {
/* Try to parse area (given in SVG pixels) */
gdouble x0,y0,x1,y1;
- if (!sscanf(sp_export_area, "%lg:%lg:%lg:%lg", &x0, &y0, &x1, &y1) == 4) {
+ if (sscanf(sp_export_area, "%lg:%lg:%lg:%lg", &x0, &y0, &x1, &y1) != 4) {
g_warning("Cannot parse export area '%s'; use 'x0:y0:x1:y1'. Nothing exported.", sp_export_area);
return;
}