34 gchar
const *path = g_getenv(
"PATH");
35 gchar *new_path = g_strdup_printf(
"%s" G_SEARCHPATH_SEPARATOR_S
"%s", program_dir, path);
36 g_setenv(
"PATH", new_path,
true);
44 auto pythonpath = extensiondir_user + G_SEARCHPATH_SEPARATOR + extensiondir_system;
46 auto pythonpath_old = Glib::getenv(
"PYTHONPATH");
47 if (!pythonpath_old.empty()) {
48 pythonpath += G_SEARCHPATH_SEPARATOR + pythonpath_old;
51 pythonpath += G_SEARCHPATH_SEPARATOR + Glib::build_filename(extensiondir_system,
"inkex",
"deprecated-simple");
53 Glib::setenv(
"PYTHONPATH", pythonpath);
56 Glib::setenv(
"PYTHONIOENCODING",
"UTF-8");
62 wchar_t *installation_dir_w = (
wchar_t *)g_utf8_to_utf16(installation_dir, -1, NULL, NULL, NULL);
63 SetDllDirectoryW(installation_dir_w);
64 g_free(installation_dir_w);
74 std::string xdg_data_dirs = Glib::getenv(
"XDG_DATA_DIRS");
76 if (xdg_data_dirs.empty()) {
81 auto data_dirs = Glib::get_system_data_dirs();
82 xdg_data_dirs = boost::join(data_dirs, G_SEARCHPATH_SEPARATOR_S);
83#elif defined(__APPLE__)
88 xdg_data_dirs =
"/usr/local/share/:/usr/share/";
93 Glib::setenv(
"XDG_DATA_DIRS", xdg_data_dirs + G_SEARCHPATH_SEPARATOR_S + inkscape_datadir);
117 static std::vector<char *> argv_new;
118 char *file =
nullptr;
120 for (
int i = 0; i < argc; ++i) {
121 if (g_str_equal(argv[i],
"--without-gui") || g_str_equal(argv[i],
"-z")) {
122 std::cerr <<
"Warning: Option --without-gui= is deprecated" << std::endl;
126 if (g_str_has_prefix(argv[i],
"--file=")) {
127 std::cerr <<
"Warning: Option --file= is deprecated" << std::endl;
132 bool found_legacy_export =
false;
134 for (
char const *type : {
"png",
"pdf",
"ps",
"eps",
"emf",
"wmf",
"plain-svg" }) {
135 auto s = std::string(
"--export-").append(type).append(
"=");
136 if (g_str_has_prefix(argv[i], s.c_str())) {
137 std::cerr <<
"Warning: Option " << s <<
" is deprecated" << std::endl;
139 if (g_str_equal(type,
"plain-svg")) {
140 argv_new.push_back(g_strdup(
"--export-plain-svg"));
144 argv_new.push_back(g_strdup_printf(
"--export-type=%s", type));
145 argv_new.push_back(g_strdup_printf(
"--export-filename=%s", argv[i] + s.size()));
147 found_legacy_export =
true;
152 if (found_legacy_export) {
156 argv_new.push_back(argv[i]);
160 argv_new.push_back(file);
163 argc = argv_new.size();
164 argv = argv_new.data();
167int main(
int argc,
char *argv[])
169 Gtk::Application::wrap_in_search_entry2();
173 signal(SIGPIPE, SIG_IGN);
177 gsl_set_error_handler_off();
186 if (g_str_has_suffix(program_dir,
"Contents/MacOS")) {
193 for (
int i = 0; i < argc; i++) {
195 if (!g_str_has_prefix(argv[i],
"-psn_")) {
196 argv[new_argc] = argv[i];
200 if (argc > new_argc) {
201 argv[new_argc] =
nullptr;
212 const unsigned int initial_cp = GetConsoleOutputCP();
213 SetConsoleOutputCP(CP_UTF8);
215 _setmode(_fileno(stdout), _O_BINARY);
228 SetConsoleOutputCP(initial_cp);
static void convert_legacy_options(int &argc, char **&argv)
Convert some legacy 0.92.x command line options to 1.0.x options.
static void set_extensions_env()
static void set_themes_env()
Adds the local inkscape directory to the XDG_DATA_DIRS so themes and other Gtk resources which are sp...
static void set_win32_env()